🐞 fix(gvg): 调整spine下发数量开关

This commit is contained in:
luying
2023-03-10 11:59:44 +08:00
parent 38b7b66263
commit 621608d0cf
4 changed files with 24 additions and 10 deletions

View File

@@ -451,6 +451,11 @@ export async function redisAddSettleScore(gvgTeam: GVGTeamType, incScore: number
await r2.setRankWithLeagueInfo(leagueCode, incScore, Date.now(), null, true);
}
export async function getSpineCnt() {
let cnt = await redisClient().getAsync(REDIS_KEY.GVG_SPINE_CNT);
return cnt? parseInt(cnt): 20;
}
// 获取排行榜
export async function getBattleRanksByCity(configId: number, groupKey: string, cityId: number, myLeague?: GVGLeagueType) {
let teamObj = getGVGBattleData(groupKey);
@@ -478,6 +483,8 @@ export async function gvgBattleSeconds() {
const { configId, period } = getGVGPeriodData();
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
const serverNames = await getAllServerName();
let spineCnt = await getSpineCnt();
let keys: { groupKey: string, cityId: number }[] = []
for(let [_key, teamObj] of getGVGBattleMap()) {
// console.log('#### gvgBattleSeconds groupKey: ', _key, 'areas', teamObj.findAreas(), 'appid', pinus.app.getServerId());
@@ -495,7 +502,7 @@ export async function gvgBattleSeconds() {
let spinesByCity = new Map<number, GVGTeamSpineInMap[]>();
for(let areaId of teamObj.findAreas()) {
let dicArea = gameData.gvgArea.get(areaId);
let teams = teamObj.findTeamsByArea(areaId);
let teams = teamObj.findTeamsByArea(areaId, spineCnt);
let spines = teams.map(team => new GVGTeamSpineInMap(team, serverNames));
if(!spinesByCity.has(dicArea.cityId)) spinesByCity.set(dicArea.cityId, []);
spinesByCity.get(dicArea.cityId).push(...spines);