🐞 fix(gvg): 激战期战场时间,为客户端预留载入战场时间

This commit is contained in:
luying
2023-03-22 20:12:25 +08:00
parent 254c732068
commit af87cc6b3f
3 changed files with 8 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ import { EXTERIOR, GVG } from "../pubUtils/dicParam";
import { DicGVGAreaPoint } from "../pubUtils/dictionary/DicGVGAreaPoint";
import { InitTeamParam, SaveTeamUpdateParam } from "../domain/gvgField/gvgDb";
import { GVGHeroInfo } from "../domain/dbGeneral";
import { GVG_CATAPULT, GVG_ROBOT } from "../consts";
import { GVG_BATTLE_PRE_TIME, GVG_CATAPULT, GVG_ROBOT } from "../consts";
@index({ roleId: 1, index: 1 })
@index({ teamCode: 1 })
@@ -248,13 +248,13 @@ export default class GVGTeam extends BaseModel {
// 攻击方攻击cd
public static async battleStartLockAttack(teamCode: string) {
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { attackTime: nowSeconds() + GVG.GVG_DEFAULT_ATTACK_CD, lockTime: nowSeconds() + GVG.GVG_DEFAULT_BATTLE_CD, lockTeamCode: teamCode } }, { new: true }).lean();
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { attackTime: nowSeconds() + GVG.GVG_DEFAULT_ATTACK_CD, lockTime: nowSeconds() + GVG.GVG_DEFAULT_BATTLE_CD + GVG_BATTLE_PRE_TIME, lockTeamCode: teamCode } }, { new: true }).lean();
return team;
}
// 防守方锁定cd
public static async battleStartLockDefense(teamCode: string, lockTeamCode: string) {
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { lockTime: nowSeconds() + GVG.GVG_DEFAULT_BATTLE_CD, lockTeamCode } }, { new: true }).lean();
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { lockTime: nowSeconds() + GVG.GVG_DEFAULT_BATTLE_CD + GVG_BATTLE_PRE_TIME, lockTeamCode } }, { new: true }).lean();
return team;
}