🐞 fix(gvg): 修复gvg显示问题

This commit is contained in:
luying
2023-02-22 21:04:21 +08:00
parent 1190d64d24
commit c9e9184567
6 changed files with 21 additions and 11 deletions
@@ -9,6 +9,7 @@ import { RoleModel } from '../../../db/Role';
import { getFriendRelationType } from '../../../services/friendService';
import { GVGLeagueModel } from '../../../db/GVGLeague';
import { getGroupIdOfServer } from '../../../services/gvg/gvgService';
import { getGuildCodeString } from '../../../services/gvg/gvgRecService';
export default function (app: Application) {
@@ -35,7 +36,7 @@ export class ChatHandler {
const guildCode = session.get('guildCode');
const sid = session.get('sid');
let channelId = '';
let channelId = '', otherInfo = '';
if (channel === CHANNEL_PREFIX.WORLD) channelId = `${serverId}`;
if (channel === CHANNEL_PREFIX.GUILD) channelId = guildCode;
if (channel === CHANNEL_PREFIX.GVG) {
@@ -46,8 +47,9 @@ export class ChatHandler {
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
if(!myLeague) return resResult(STATUS.GVG_NOT_JOIN_LEAGUE);
channelId = myLeague.leagueCode;
otherInfo = getGuildCodeString(myLeague);
}
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode, otherInfo);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
await pushGroupMsgToRoom(msgData);
@@ -6,7 +6,7 @@ import { GVGCityModel } from '../../../db/GVGCity';
import { Application, BackendSession, ChannelService, HandlerService, pinus } from "pinus";
import { resResult, genCode } from "../../../pubUtils/util";
import { GVGLeagueModel } from '../../../db/GVGLeague';
import { getGroupKey, getGVGConfig, getGVGPeriodData } 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 } from '../../../services/gvg/gvgBattleService';
import { getGVGBattleData } from '../../../services/gvg/gvgBattleMemory';
import { GVGBattleRecModel } from '../../../db/GVGBattleRec';
@@ -214,7 +214,7 @@ export class GVGBattleHandler {
teamObj.enterCity(...teams);
}
const recs = await GVGRecModel.findBattleRecByCity(configId, groupKey, cityId);
// const recs = await GVGRecModel.findBattleRecByCity(configId, groupKey, cityId);
const teamResult = teams.map(team => new MyTeamInfo(team));
const { ranks, myRank } = await getBattleRanksByCity(configId, groupKey, cityId, myLeague);
await leaveGVGCityTeamChannel(roleId, sid);
@@ -223,7 +223,7 @@ export class GVGBattleHandler {
return resResult(STATUS.SUCCESS, {
cityId,
ranks, myRank,
recs,
recs: [],
teams: teamResult,
});
}
@@ -624,12 +624,14 @@ export class GVGBattleHandler {
let { configId } = getGVGPeriodData();
let groupKey = await getGroupKey(serverId);
let serverType = await getGVGServerType(serverId);
const cities = await GVGCityModel.findByConfig(configId, groupKey);
const points = await GVGCityAreaPointModel.findByConfig(configId, groupKey);
let result: { cityId: number, guardLeagueName: string, areas: { areaId: number, points: { pointId: number, guardLeagueName: string }[] }[] }[] = [];
for(let [ cityId, { areaIds }] of gameData.gvgCity) {
for(let [ cityId, { mapType, areaIds }] of gameData.gvgCity) {
if(mapType != serverType) continue;
let areas: { areaId: number, points: {pointId: number, guardLeagueName: string }[]}[] = [];
for(let areaId of areaIds) {
let dicArea = gameData.gvgArea.get(areaId);
+6 -1
View File
@@ -20,9 +20,10 @@ import { GVGUserTaskModel } from "../../db/GVGUserTask";
import { getMyAuth } from "./gvgTeamService";
import { pick } from "underscore";
import { calFighterContribute, calProducerContribute } from "./gvgPrepareService";
import { calVestigeLeagueBoxRewards } from "./gvgFightService";
import { calVestigeLeagueBoxRewards, getFightTimeByPeriod } from "./gvgFightService";
import { GVGVestigeLeagueRankModel } from "../../db/GVGVestigeLeagueRank";
import { GVGVestigeSumRankModel } from "../../db/GVGVestigeSumRank";
import { GVGTeamModel } from "../../db/GVGTeam";
// 定时器相关
export async function createNewGVGConfig() {
@@ -213,6 +214,7 @@ export async function getGVGInfoInGuild(roleId: string, guild: GuildType) {
let hasLeague = !!guild.leagueCode;
let serverId = guild.serverId;
let { configId, period, countdownTime } = getGVGPeriodData();
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
let type = await getGVGServerType(serverId);
if(hasLeague && configId > 0) {
@@ -223,11 +225,14 @@ export async function getGVGInfoInGuild(roleId: string, guild: GuildType) {
applyCnt: await getApplyCnt(guild.leagueCode),
...await getMainData(roleId, guild.leagueCode, configId, period, countdownTime, type),
leagueDetailRank: await getLeagueRankBox(configId, guild.leagueCode, roleId),
myTeamCnt: await GVGTeamModel.getTeamCntByRole(roleId),
startFightTime, endFightTime
}
} else {
return {
hasLeague,
configId, period, countdownTime,
startFightTime, endFightTime,
type,
invitationCnt: await getInviteCnt(guild.code)
}