🐞 fix(gvg): 排行榜添加
This commit is contained in:
@@ -15,7 +15,7 @@ import { GVGLeaguePrepareModel } from "../../db/GVGLeaguePrepare";
|
||||
import { pinus } from "pinus";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { Rank } from "../rankService";
|
||||
import { LeagueRankInfo, RoleRankInfo } from "../../domain/rank";
|
||||
import { KeyNameParam, LeagueRankInfo, myIdInter, RoleRankInfo } from "../../domain/rank";
|
||||
import { findKeys, getAllServerName } from "../redisService";
|
||||
import { sendMessageToGVGAreaByTeamWithSuc, sendMessageToGVGAreaWithSuc, sendMessageToGVGCityWithSuc, sendMessageToUserWithSuc } from "../pushService";
|
||||
import { sendMailByContent, sendMailToLeagueByContent } from "../mailService";
|
||||
@@ -117,7 +117,7 @@ export function checkMoveStatus(team: GVGTeamType, cityId: number, areaId: numbe
|
||||
export async function initRobots(configId: number, groupKey: string, city: GVGCityType | { cityId: number, guardLeague: string }) {
|
||||
let { cityId, guardLeague = '' } = city;
|
||||
if(guardLeague) return [];
|
||||
let robotTeams = await GVGTeamModel.findRobotTeams(groupKey, cityId);
|
||||
let robotTeams = await GVGTeamModel.findRobotTeams(configId, groupKey, cityId);
|
||||
let updateDicPoints: DicGVGAreaPoint[] = [];
|
||||
let { battleAreaIds = []} = gameData.gvgCity.get(cityId);
|
||||
for(let areaId of battleAreaIds) {
|
||||
@@ -645,4 +645,23 @@ export async function pushTeamMoveMessage(team: GVGTeamType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// —————————— 推送相关 end —————————— //
|
||||
// —————————— 推送相关 end —————————— //
|
||||
|
||||
// 外面页面上的排行榜
|
||||
export async function getBattleRank(redisKey: REDIS_KEY, keyParam: KeyNameParam, myId: myIdInter) {
|
||||
let r = new Rank(redisKey, keyParam);
|
||||
r.setGenerFieldsFun((obj => {
|
||||
if(obj instanceof LeagueRankInfo) return { rank: obj.rank, name: obj.name, score: obj.num }
|
||||
if(obj instanceof RoleRankInfo) return { rank: obj.rank, name: obj.roleName, score: obj.num }
|
||||
}));
|
||||
|
||||
let { ranks, myRank } = await r.getRankListWithMyRank(myId);
|
||||
if (!myRank) {
|
||||
if(redisKey == REDIS_KEY.GVG_BATTLE_RANK) {
|
||||
myRank = await r.generMyRankWithRole(myId.roleId, 0, 0);
|
||||
} else if (redisKey == REDIS_KEY.GVG_BATTLE_LEAGUE_RANK) {
|
||||
myRank = await r.generMyRankWithLeague(myId.leagueCode, 0, 0);
|
||||
}
|
||||
}
|
||||
return { ranks, myRank }
|
||||
}
|
||||
Reference in New Issue
Block a user