✨ feat(gvg): 排行榜奖励邮件
This commit is contained in:
@@ -2,8 +2,8 @@ import { GVGTeamMem } from "../../domain/battleField/gvgBattle";
|
||||
import { GVGLeagueType } from "../../db/GVGLeague";
|
||||
import { GVGTeamModel, GVGTeamType, GVGTeamUpdate } from "../../db/GVGTeam";
|
||||
import { GVGCityModel, GVGCityType } from "../../db/GVGCity";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
import { GVG_AREA_TYPE, GVG_TECH_TYPE, PUSH_ROUTE, REDIS_KEY, STATUS } from "../../consts";
|
||||
import { gameData, getGVGBattleRankReward } from "../../pubUtils/data";
|
||||
import { GVG_AREA_TYPE, GVG_BATTLE_RANK_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROUTE, REDIS_KEY, STATUS } from "../../consts";
|
||||
import { nowSeconds } from "../../pubUtils/timeUtil";
|
||||
import { DicGVGAreaPoint } from "../../pubUtils/dictionary/DicGVGAreaPoint";
|
||||
import { getGVGBattleData, getGVGBattleMap } from "./gvgBattleMemory";
|
||||
@@ -16,9 +16,10 @@ import { GVGLeaguePrepareModel } from "../../db/GVGLeaguePrepare";
|
||||
import { pinus } from "pinus";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { Rank } from "../rankService";
|
||||
import { LeagueRankInfo } from "../../domain/rank";
|
||||
import { LeagueRankInfo, RoleRankInfo } from "../../domain/rank";
|
||||
import { findKeys, getAllServerName } from "../redisService";
|
||||
import { sendMessageToChannel, sendMessageToGVGAreaByTeamWithSuc, sendMessageToGVGAreaWithSuc } from "../pushService";
|
||||
import { sendMailToLeagueByContent } from "../mailService";
|
||||
|
||||
|
||||
/**
|
||||
@@ -301,7 +302,8 @@ export async function gvgBattleEnd() {
|
||||
for(let { groupId, serverType, cityId } of rankKeys) {
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
let ranks = await r.getRankByRange();
|
||||
for(let obj of ranks) { // 排名最高
|
||||
// 排名最高占领城池
|
||||
for(let obj of ranks) {
|
||||
let rank = <LeagueRankInfo>obj;
|
||||
let cnt = guardLeagueCnt.get(rank.code)||0;
|
||||
if(cnt < GVG.GVG_CITY_OCCUPIED_NUMBER) {
|
||||
@@ -310,10 +312,30 @@ export async function gvgBattleEnd() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 联军排行榜发放奖励
|
||||
for(let _obj of ranks) {
|
||||
let obj = <LeagueRankInfo>_obj;
|
||||
let dicRank = getGVGBattleRankReward(GVG_BATTLE_RANK_TYPE.LEAGUE, obj.rank);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_BATTLE_LEAGUE_RANK_REWARD, obj.code, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
}
|
||||
}
|
||||
|
||||
// 排行榜发放奖励
|
||||
// 个人排行榜发放奖励
|
||||
let playerKeys = await findKeys(`${REDIS_KEY.GVG_BATTLE_RANK}:${configId}:`);
|
||||
for(let key of playerKeys) {
|
||||
let [,, _groupId, _serverType, _cityId] = key.split(':');
|
||||
let groupId = parseInt(_groupId);
|
||||
let serverType = parseInt(_serverType);
|
||||
let cityId = parseInt(_cityId);
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
let ranks = await r.getRankByRange();
|
||||
|
||||
for(let _obj of ranks) {
|
||||
let obj = <RoleRankInfo>_obj;
|
||||
let dicRank = getGVGBattleRankReward(GVG_BATTLE_RANK_TYPE.PLAYER, obj.rank);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_BATTLE_PLAYER_RANK_REWARD, obj.roleId, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user