寻宝:服务器重启时清理之前战斗的状态;匹配时检查队伍时间
This commit is contained in:
@@ -166,11 +166,16 @@ export default class ComBattleTeam extends BaseModel {
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async updateStatus(teamCode: string, status: number, lean = true) {
|
||||
public static async updateStatusByCode(teamCode: string, status: number, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamCode }, {status}, {new: true}).lean(lean);
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async updateStatusByStatus(preStatus: number, newStatus: number, lean = true) {
|
||||
const team = await ComBattleTeamModel.updateMany({ status: preStatus }, {status: newStatus}, {new: true}).lean(lean);
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async updateResult(teamCode: string, roleId: string, isSuccess: boolean, _lean = true) {
|
||||
let team = await ComBattleTeamModel.findOne({teamCode}).select('status roleStatus');
|
||||
if(!team) return;
|
||||
@@ -214,7 +219,8 @@ export default class ComBattleTeam extends BaseModel {
|
||||
}
|
||||
|
||||
public static async getOtherTeamByQualityAndSt(roleId: string, qualityArr: Array<number>, status: number, ce = 0, pub = true, cntLmt = 2, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOne({quality: {$in: qualityArr}, status, ceLimit: {$lte: ce}, pub, roleCnt: {$lte: cntLmt}, roleIds: {$nin: [roleId]}}).lean(lean);
|
||||
const curTime = new Date(Date.now() - 10 * 60 * 1000); // 10分钟之前
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOne({quality: {$in: qualityArr}, status, ceLimit: {$lte: ce}, pub, roleCnt: {$lte: cntLmt}, roleIds: {$nin: [roleId]}, updatedAt: {$gte: curTime}}).lean(lean);
|
||||
return team;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user