🐞 fix(gvg): 激战期推送相关修改
This commit is contained in:
@@ -22,17 +22,7 @@ import { sendMailByContent, sendMailToLeagueByContent } from "../mailService";
|
||||
import { GVGCityAreaPointModel } from "../../db/GVGCityAreaPoint";
|
||||
import { addCityGuardMessage } from "./gvgRecService";
|
||||
import { GVGUserDataModel } from "../../db/GVGUserData";
|
||||
|
||||
|
||||
/**
|
||||
* 检查上周是否有占领城池
|
||||
* @param league
|
||||
* @returns boolean 是否占领
|
||||
*/
|
||||
export async function checkHasCities(league: GVGLeagueType) {
|
||||
let { configId } = getGVGConfig();
|
||||
return await GVGCityModel.checkLeagueHasGuard(configId, league.leagueCode);
|
||||
}
|
||||
import { RoleModel } from "../../db/Role";
|
||||
|
||||
/**
|
||||
* 获取本联军上周占领的城池
|
||||
@@ -138,7 +128,8 @@ export async function refreshTeams(configId: number, groupKey: string, roleId: s
|
||||
for(let team of oldTeams) {
|
||||
if(team.configId != configId) {
|
||||
let { teamCode, maxDurability } = team;
|
||||
let newTeam = await GVGTeamModel.refreshByConfig(team.teamCode, { teamCode, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey });
|
||||
let { lv } = await RoleModel.findByRoleId(roleId, 'lv');
|
||||
let newTeam = await GVGTeamModel.refreshByConfig(teamCode, { configId, lv, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey });
|
||||
teams.push(newTeam);
|
||||
} else {
|
||||
teams.push(team);
|
||||
@@ -297,16 +288,18 @@ export async function catapultHurt() {
|
||||
let dicGVGCity = gameData.gvgCity.get(catapult.cityId);
|
||||
let teams = await GVGTeamModel.attackByCatapult(teamCodes, catapult.captapultAtk, dicGVGCity.attackBirth);
|
||||
teamObj.battleEnd(teams);
|
||||
await sendMessageToGVGAreaWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_TEAM_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGTeamInList(team))
|
||||
});
|
||||
await sendMessageToGVGAreaByTeamWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_SPINE_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGAttackSpine(team, catapult.captapultAtk))
|
||||
});
|
||||
for(let team of teams) {
|
||||
await pushTeamBeHurtMessage(team);
|
||||
if(team.curTeamBreak && team.originPointId > 0) {
|
||||
await GVGCityAreaPointModel.leavePoint(configId, teamObj.groupKey, team.originPointId);
|
||||
if(teams.length > 0) {
|
||||
await sendMessageToGVGAreaByTeamWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_TEAM_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGTeamInList(team))
|
||||
});
|
||||
await sendMessageToGVGAreaWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_SPINE_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGAttackSpine(team, catapult.captapultAtk))
|
||||
});
|
||||
for(let team of teams) {
|
||||
await pushTeamBeHurtMessage(team);
|
||||
if(team.curTeamBreak && team.originPointId > 0) {
|
||||
await GVGCityAreaPointModel.leavePoint(configId, teamObj.groupKey, team.originPointId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user