🐞 fix(gvg): 修复gvg激战期bug

This commit is contained in:
luying
2023-02-21 14:52:36 +08:00
parent 2dffaa7f80
commit 8a14b5bd48
11 changed files with 71 additions and 38 deletions

View File

@@ -82,6 +82,12 @@ export default class GVGBattleRec extends BaseModel {
@prop({ required: true, type: TeamInfo, _id: false })
defenseTeam: TeamInfo; // 防守队伍
@prop({ required: true, type: TeamInfo, _id: false })
attackTeamAfter: TeamInfo; // 挑战队伍
@prop({ required: true, type: TeamInfo, _id: false })
defenseTeamAfter: TeamInfo; // 防守队伍
@prop({ required: true })
isSuccess: boolean;
@@ -99,8 +105,8 @@ export default class GVGBattleRec extends BaseModel {
return result;
}
public static async battleEnd(battleCode: string, isSuccess: boolean) {
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { isSuccess, battleEndTime: nowSeconds() } }, { new: true }).lean();
public static async battleEnd(battleCode: string, isSuccess: boolean, attackTeam: GVGTeamType, defenseTeam: GVGTeamType) {
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { isSuccess, battleEndTime: nowSeconds(), attackTeamAfter: attackTeam, defenseTeamAfter: defenseTeam } }, { new: true }).lean();
return result;
}
}