阿里云服务空间,代码如下:
const transaction = await this.db.startTransaction();
try {
console.log("=====6666666",max_unum_id);
let {data:idlist} = await transaction.collection('sys_base').doc(max_unum_id).get();
console.log("=====77777777",idlist);
let {value} = idlist;
console.log("=====77777777");
value++;
let new_id = value;
numID = new_id;
Object.assign(par,{user_type:5,numID:new_id,score:0,geted_score:0,used_score:0,mInfo});
console.log("=====88888888");
res = await uniID.updateUser(par);
await transaction.collection('sys_base').doc(max_unum_id).update({value});
await transaction.commit()
console.log("=====9999999");
} catch(e) {
console.log("=====aaaaaaaa");
await transaction.rollback()
console.error(`-------transaction error`, e)
throw Error(e.message);
}
是和云函数,单实例并发度 10 的设置有关吗? 还是代码写的有问题。
mvlyforever (作者)
感谢,回复问题的 老铁们 都是 hero!
2023-07-06 10:07