const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const MAX_LIMIT = 100
//.doc(this.data.id_)
exports.main = async(event, context) => {
const wxContext = cloud.getWXContext()
return await db.collection("userlist").where({
_id: wxContext.OPENID
}).orderBy('time', 'desc').get({
success: function(res) {
// return res
}
});
return {
// data,
event,
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
}
}
这时候都没有人 = =看,只有自己先找一找https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/document/Document.get.html
相关的内容,doc 的id
return await db.collection("userlist").where({
_id: wxContext.OPENID//获取用户openid后,给where做筛选条件
}).orderBy('time', 'desc').get({
success: function(res) {
// return res
}
});