任务:根据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) {

View File

@@ -12,8 +12,10 @@ import { ItemInter } from './interface';
export async function checkTaskWithRoles(taskType: number, roles: RoleType[], funcs?: number[]) {
let pushMessage = new Array<{type: number, id: number, count: number, received: boolean}>();
for(let role of roles) {
let singlePush = await checkTaskWithRole(role.roleId, taskType, role, funcs);
pushMessage.concat(singlePush);
if(role) {
let singlePush = await checkTaskWithRole(role.roleId, taskType, role, funcs);
pushMessage.concat(singlePush);
}
}
return pushMessage
}
@@ -306,7 +308,7 @@ export async function checkTaskWithGoods(roleId: string, taskType: number, goods
// 根据taskType判断有哪些任务需要check的
export async function checkTask(roleId: string, taskType: number, count: number, isInc: boolean, param: TaskParam, funcs?: number[]) {
let tasks = gameData.taskType.get(taskType);
let tasks = gameData.taskType.get(taskType)||[];
let pushMessage = new Array<{type: number, id: number, count: number, received: boolean}>();
let groups = new Map<number, { task0: DicTask, tasks: DicTask[] }>();
for(let dicTask of tasks) {