const cloud = require('wx-server-sdk')
cloud.init({env:"env-cwh01-q9lg9"})
// 云函数入口函数
const DB = cloud.database();
exports.main = async (event, context) => {
console.log("事件",event)
try {
if(event.option=='add'){
return await DB.collection('employeeindex')
.where({
name:event.name,
num:event.num,
})
.update({
data:{
name:event.name,
department:event.department,
job:event.job,
num:event.num,
performance_index:event.performance_index,
performance_index_code:event.performance_index_code,
performance_index_quota:event.performance_index_quota,
evaluator_department:event.evaluator_department,
evaluator:event.evaluator,
performance_index_objective:event.performance_index_objective,
evaluation_data:event.evaluation_data,
score:event.score,
filed:event.filed,
score_rule:event.score_rule,
}
});
}
}catch (e) {
console.error(e)
}
}
- result:
- errMsg: "collection.update:ok"
我的数据库记录是通过代码导入数据库的!数据权限也修改了,还是没用
{
"read": true,
"write": true
}