怎样把查询出来的数据,写到subscribeMessage.send中?
const cloud = require('wx-server-sdk')
cloud.init({
env:
})
const db= cloud.database()
const conm = db.command
exports.main = async (event, context) => {
try {
db.collection("xxxx1").where(
conm.and([
{
ff:2222
},
{
zz:1111
},
])
)
.count()
.then(res => {
console.log(res);
var leng=res.total
const result = await cloud.openapi.subscribeMessage.send({
touser:'xxxxxxxxxxxxxxxxxxxxxx',
data: {
thing4: {
value:leng
},
date3: {
value: '456'
},
},
templateId: 'INxxxxxxxxxxxxxxxxxxxxxxxxxY',
miniprogramState: 'developer'
})
return result
} catch (err) {
return err
}
})
}
}