You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
502 B

// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
}) // 使用当前云环境
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
const openID = cloud.getWXContext().OPENID;
try {
return await db.collection('todo').where({
id: event.id,
_openid: openID,
}).update({
data: {
checked: event.checked,
},
})
} catch (e) {
console.log('更新出错!');
console.log(e);
}
}