云筱易
云筱易
  • 发布:2020-06-02 17:07
  • 更新:2020-06-02 17:07
  • 阅读:756

【报Bug】uniapp 客户端通过按钮调用云函数或把云函数写进onshow里面执行云函数向数据库添加数据 ,会重复添加

分类:uniCloud

产品分类: uniCloud/腾讯云

操作步骤:

//云函数ez_notice
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
const collection = db.collection('notice')
let res =await collection.add(event)
return res
};
//客户端
<template>
<view>
<view class="">
<view class="">标题</view>
<input class="bor" type="text" v-model="title" />
</view>
<view class="">
<view class="">内容</view>
<input class="bor" type="text" v-model="content" />
</view>
<button type="default" @click="tj">提交</button>
</view>
</template>

<script>
export default {
data() {
return {
title:"",
content:""
}
},
methods: {
tj(){
uniCloud.callFunction({
name:'ez_notice',
data:{
title:this.title,
content:this.content
}
}).then(res=>{console.log('res',res)})
}
}
}
</script>

<style>
.bor{
border: #333333 solid 3rpx;
background-color: #fafafa;
}
</style>

预期结果:

_id

75777da85ed615880027d7e27f63c218
content

使用腾讯云执行数据库添加操作,云函数会被无故执行两次,在客户端onshow里面也会被无故调用两次云函数
title

bug提交

实际结果:

_id

75777da85ed615880027d7e27f63c218
content

使用腾讯云执行数据库添加操作,云函数会被无故执行两次,在客户端onshow里面也会被无故调用两次云函数
title

bug提交

id

4c5846c75ed6158c002a6e89101ce715
content

使用腾讯云执行数据库添加操作,云函数会被无故执行两次,在客户端onshow里面也会被无故调用两次云函数
title

bug提交

bug描述:

使用腾讯云调用云函数执行向数据添加数据的操作,会自动增加一条异常的数据。也就是说原本只执行增加一天记录的操作,实际上添加的云函数会被无故调用两次

2020-06-02 17:07 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复