exports.main = async (event, context) => {
const dbUser = cloud.database().collection('user')
let user = event.user
let res = dbUser.where({
openid:user.openid
}).get()
if(res == null) //这里应该如何判空呢?
{
res = dbUser.add({
openid:user.openid
})
}
return res;
}
let res = await dbUser.where({ openid:user.openid }).get() console.log(res) j加个await,先看看res是啥