任务:根据test结果修复

This commit is contained in:
luying
2021-04-19 14:05:26 +08:00
parent dd6c3355c3
commit bc612c81c1
4 changed files with 12 additions and 8 deletions

View File

@@ -599,19 +599,19 @@ export default class Role extends BaseModel {
if(max) {
condition['friendCnt'] = {$lte: max - inc};
}
const result: RoleType = await RoleModel.findOneAndUpdate(condition, {$inc: { friendCnt: inc }}, {new: true}).lean();
const result: RoleType = await RoleModel.findOneAndUpdate(condition, {$inc: { friendCnt: inc }}, {new: true}).lean({ getters: true, virtuals: true });
return result;
}
// 增加好友申请数量
public static async increaseFriendApplyCnt(roleId: string, inc: number, max: number) {
const result: RoleType = await RoleModel.findOneAndUpdate({ roleId, recFrdApplyCnt: {$lte: max - inc}}, {$inc: { recFrdApplyCnt: inc }}, {new: true}).lean();
const result: RoleType = await RoleModel.findOneAndUpdate({ roleId, recFrdApplyCnt: {$lte: max - inc}}, {$inc: { recFrdApplyCnt: inc }}, {new: true}).lean({ getters: true, virtuals: true });
return result;
}
// 增加黑名单数量
public static async increaseBlockCnt(roleId: string, blockCnt: number, friendCnt: number, maxBlockCnt: number) {
const result: RoleType = await RoleModel.findOneAndUpdate({ roleId, blockCnt: {$lte: maxBlockCnt - blockCnt}}, {$inc: { blockCnt, friendCnt }}, {new: true}).lean();
const result: RoleType = await RoleModel.findOneAndUpdate({ roleId, blockCnt: {$lte: maxBlockCnt - blockCnt}}, {$inc: { blockCnt, friendCnt }}, {new: true}).lean({ getters: true, virtuals: true });
return result;
}
public static async updatedRoleMailAt(roleId: string, updatedMailAt: number, lean = true) {