// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()//打开数据库连接
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
try{
db.collection("client").doc(event.id).update({
data: {
userName: event.userName,
alias: event.alias,
mobile: event.mobile,
address: event.address,
createTime: db.serverDate()
}
})
} catch (e) {
console.error('err:', e)
}
}
为什么,因为你没return 啊
let res = {}
try{
res = await db.....
}catch(e){
res = e
}
return res