🐞 fix(gvg): 修复零散小问题
This commit is contained in:
@@ -170,12 +170,12 @@ class GVGBattleData {
|
||||
return teams;
|
||||
}
|
||||
|
||||
public findSettledPointMapByLeague() {
|
||||
public findSettledPointMapByLeague(cityId: number) {
|
||||
let pointByLeague = new Map<string, number[]>();
|
||||
for(let [_roleId, pointIds] of this.rolePoints) {
|
||||
for(let [pointId, teamCode] of pointIds) {
|
||||
let team = this.teams.get(teamCode);
|
||||
if(pointId > 0 && team && team.leagueCode) {
|
||||
if(pointId > 0 && team && team.leagueCode && team.cityId == cityId) {
|
||||
if(!pointByLeague.has(team.leagueCode)) pointByLeague.set(team.leagueCode, []);
|
||||
pointByLeague.get(team.leagueCode).push(team.pointId);
|
||||
};
|
||||
|
||||
@@ -404,10 +404,10 @@ export async function catapultHurt() {
|
||||
cityId: catapult.cityId, areaId, attackType: GVG_ATTACK_TYPE.CATAPULT, teams: myTeams
|
||||
});
|
||||
}
|
||||
await sendMessageToGVGCityWithSuc(teamObj.groupKey, catapult.cityId, PUSH_ROUTE.GVG_SPINE_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId, teamCode: catapult.teamCode, attackType: GVG_ATTACK_TYPE.CATAPULT, spines: teams.map(team => new GVGAttackSpine(team, catapult.captapultAtk))
|
||||
});
|
||||
}
|
||||
await sendMessageToGVGCityWithSuc(teamObj.groupKey, catapult.cityId, PUSH_ROUTE.GVG_SPINE_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId, teamCode: catapult.teamCode, attackType: GVG_ATTACK_TYPE.CATAPULT, spines: teams.map(team => new GVGAttackSpine(team, catapult.captapultAtk))
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,7 +440,7 @@ export async function redisAddSettleScore(gvgTeam: GVGTeamType, incScore: number
|
||||
// 获取排行榜
|
||||
export async function getBattleRanksByCity(configId: number, groupKey: string, cityId: number, myLeague?: GVGLeagueType) {
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
let pointByLeague = teamObj.findSettledPointMapByLeague();
|
||||
let pointByLeague = teamObj.findSettledPointMapByLeague(cityId);
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupKey, cityId });
|
||||
r.setGenerFieldsFun((obj => {
|
||||
if(obj instanceof LeagueRankInfo) {
|
||||
@@ -591,7 +591,6 @@ async function addGuardCity(configId: number, groupKey: string, cityId: number,
|
||||
await GVGCityModel.guardCity(configId, groupKey, cityId, league);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_GUARD_CITY_REWARD, leagueCode, { params: [dicCity.cityName], goods: dicCityAdd.occupyReward }, league);
|
||||
await addCityGuardMessage(league, cityId);
|
||||
await GVGLeagueModel.removeAuto(leagueCode);
|
||||
}
|
||||
|
||||
// —————————— 定时器相关 end —————————— //
|
||||
|
||||
@@ -43,7 +43,8 @@ export async function createNewGVGConfig() {
|
||||
let autoLeagues = await GVGLeagueModel.findAutoCreateLeague();
|
||||
let needDissmissLeagueId: string[] = [], needDissmissLeagueCodes: string[] = [];
|
||||
for(let league of autoLeagues) {
|
||||
if(!await GVGCityModel.checkLeagueHasGuard(config.configId, league.leagueCode)) {
|
||||
let groupKey = await getGroupKey(league.serverId);
|
||||
if(!await GVGCityModel.checkLeagueHasGuard(config.configId, groupKey, league.leagueCode)) {
|
||||
needDissmissLeagueId.push(league._id);
|
||||
needDissmissLeagueCodes.push(league.leagueCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user