云函数代码:
const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV })
exports.main = async (event, context) => {
await cloud.database().collection("data").add({
data: {
imageUrl: event.imageUrl,
imageNumber: event.imageNumber,
page: event.page,
address: event.address,
expression: event.expression,
phonenumber: event.phonenumber,
view: event.view,
index: event.index,
date: event.date
}
}).then(res=>{
console.log("成功上传", res)
})
}
调用js的代码:
uploadData(){
wx.cloud.callFunction({
name:"upData",
data:{
imageUrl:this.imageUrl,
imageNumber:this.imageNumber,
page:this.page,
address:this.address,
expression:this.expression,
phonenumber:this.phonenumber,
view:this.view,
index:this.index,
date:this.date
}
}).then(res=>{
console.log("云函数调用成功")
})
}
在数据库集合里面没有新增的数据吗
这能看出来什么