🐞 fix(gvg): 结算页面将其他城池也返回
This commit is contained in:
@@ -7,7 +7,7 @@ import { Application, BackendSession, ChannelService, HandlerService, pinus } fr
|
|||||||
import { resResult, genCode, getRandSingleEelm } from "../../../pubUtils/util";
|
import { resResult, genCode, getRandSingleEelm } from "../../../pubUtils/util";
|
||||||
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
||||||
import { getGroupKey, getGVGConfig, getGVGPeriodData, getGVGServerType } from '../../../services/gvg/gvgService';
|
import { getGroupKey, getGVGConfig, getGVGPeriodData, getGVGServerType } from '../../../services/gvg/gvgService';
|
||||||
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getGVGCitiesInfo, leaveCity, refreshTeams, checkEnterCityTime, generNewLineup, getBattleRank, checkSettleStatus, getSpineCnt } from '../../../services/gvg/gvgBattleService';
|
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getAllGVGCitiesInfo, leaveCity, refreshTeams, checkEnterCityTime, generNewLineup, getBattleRank, checkSettleStatus, getSpineCnt } from '../../../services/gvg/gvgBattleService';
|
||||||
import { getGVGBattleData } from '../../../services/gvg/gvgBattleMemory';
|
import { getGVGBattleData } from '../../../services/gvg/gvgBattleMemory';
|
||||||
import { GVGBattleRecModel } from '../../../db/GVGBattleRec';
|
import { GVGBattleRecModel } from '../../../db/GVGBattleRec';
|
||||||
import { getFightTimeByPeriod } from '../../../services/gvg/gvgFightService';
|
import { getFightTimeByPeriod } from '../../../services/gvg/gvgFightService';
|
||||||
@@ -700,7 +700,8 @@ export class GVGBattleHandler {
|
|||||||
|
|
||||||
let { configId } = getGVGPeriodData();
|
let { configId } = getGVGPeriodData();
|
||||||
let groupKey = await getGroupKey(serverId);
|
let groupKey = await getGroupKey(serverId);
|
||||||
let cities = await getGVGCitiesInfo(configId, groupKey);
|
let serverType = await getGVGServerType(serverId);
|
||||||
|
let cities = await getAllGVGCitiesInfo(configId, groupKey, serverType);
|
||||||
|
|
||||||
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||||
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
|
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ export class GVGHandler {
|
|||||||
const guilds = await GuildModel.findByCodesWithoutPopulate(leagues.reduce((pre, cur) => [...pre, ...cur.guildCodes], []));
|
const guilds = await GuildModel.findByCodesWithoutPopulate(leagues.reduce((pre, cur) => [...pre, ...cur.guildCodes], []));
|
||||||
|
|
||||||
const result: GuardCityInfoPage[] = [];
|
const result: GuardCityInfoPage[] = [];
|
||||||
for(let { cityId, guardLeagueCode } of result) {
|
for(let { cityId, guardLeague: guardLeagueCode } of cities) {
|
||||||
let league = leagues.find(cur => cur.leagueCode == guardLeagueCode);
|
let league = leagues.find(cur => cur.leagueCode == guardLeagueCode);
|
||||||
if(!league) continue;
|
if(!league) continue;
|
||||||
let prepare = prepares.find(cur => cur.leagueCode == guardLeagueCode);
|
let prepare = prepares.find(cur => cur.leagueCode == guardLeagueCode);
|
||||||
@@ -596,6 +596,7 @@ export class GVGHandler {
|
|||||||
|
|
||||||
let data = new GuardCityInfoPage(cityId);
|
let data = new GuardCityInfoPage(cityId);
|
||||||
data.setGuardLeague(league, prepare, leagueCe);
|
data.setGuardLeague(league, prepare, leagueCe);
|
||||||
|
result.push(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ export async function getGVGCitiesInfo(configId: number, groupKey: string, leagu
|
|||||||
let cities = await GVGCityModel.findGuardCity(configId, groupKey);
|
let cities = await GVGCityModel.findGuardCity(configId, groupKey);
|
||||||
let result: GVGCityMapInfo[] = [];
|
let result: GVGCityMapInfo[] = [];
|
||||||
for(let city of cities) {
|
for(let city of cities) {
|
||||||
let obj = new GVGCityMapInfo(city);
|
let obj = new GVGCityMapInfo(city.cityId);
|
||||||
|
obj.setCity(city);
|
||||||
if(league) {
|
if(league) {
|
||||||
let players = (city.players||[]).filter(cur => cur.leagueCode == league.leagueCode);
|
let players = (city.players||[]).filter(cur => cur.leagueCode == league.leagueCode);
|
||||||
obj.setTeamCnt(players.length);
|
obj.setTeamCnt(players.length);
|
||||||
@@ -62,6 +63,19 @@ export async function getGVGCitiesInfo(configId: number, groupKey: string, leagu
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getAllGVGCitiesInfo(configId: number, groupKey: string, serverType: number) {
|
||||||
|
let cities = await GVGCityModel.findGuardCity(configId, groupKey);
|
||||||
|
let result: GVGCityMapInfo[] = [];
|
||||||
|
for(let [cityId, { mapType }] of gameData.gvgCity) {
|
||||||
|
if(mapType != serverType) continue;
|
||||||
|
let obj = new GVGCityMapInfo(cityId);
|
||||||
|
let city = cities.find(cur => cur.cityId == cityId);
|
||||||
|
obj.setCity(city);
|
||||||
|
result.push(obj);
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取内存中队伍的数据结构
|
* 获取内存中队伍的数据结构
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default class GVGLeaguePrepare extends BaseModel {
|
|||||||
|
|
||||||
|
|
||||||
public static async findByLeagueCodes(configId: number, leagueCodes: string[]) {
|
public static async findByLeagueCodes(configId: number, leagueCodes: string[]) {
|
||||||
const result: GVGLeaguePrepareType[] = await GVGLeaguePrepareModel.findOne({ configId, leagueCode: { $in: leagueCodes } }).lean();
|
const result: GVGLeaguePrepareType[] = await GVGLeaguePrepareModel.find({ configId, leagueCode: { $in: leagueCodes } }).lean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -626,15 +626,18 @@ export class VestigeRank {
|
|||||||
// 大地图上城池占林
|
// 大地图上城池占林
|
||||||
export class GVGCityMapInfo {
|
export class GVGCityMapInfo {
|
||||||
cityId: number; // 城池id
|
cityId: number; // 城池id
|
||||||
guardLeagueCode: string; // 驻守城池的联军id
|
guardLeagueCode: string = ''; // 驻守城池的联军id
|
||||||
guardLeagueName: string; // 驻守这个城池的联军
|
guardLeagueName: string = ''; // 驻守这个城池的联军
|
||||||
guardLeagueIcon: number; // 驻守这个城池的联军的icon
|
guardLeagueIcon: number = 0; // 驻守这个城池的联军的icon
|
||||||
teamCnt: number; // 我方人数
|
teamCnt: number; // 我方人数
|
||||||
score: number;
|
score: number;
|
||||||
|
|
||||||
constructor(city: GVGCityType) {
|
constructor(cityId: number) {
|
||||||
|
this.cityId = cityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCity(city: GVGCityType) {
|
||||||
if(!city) return;
|
if(!city) return;
|
||||||
this.cityId = city.cityId;
|
|
||||||
this.guardLeagueCode = city.guardLeague;
|
this.guardLeagueCode = city.guardLeague;
|
||||||
this.guardLeagueName = city.guardLeagueName;
|
this.guardLeagueName = city.guardLeagueName;
|
||||||
this.guardLeagueIcon = city.guardLeagueIcon;
|
this.guardLeagueIcon = city.guardLeagueIcon;
|
||||||
|
|||||||
Reference in New Issue
Block a user