✨ feat(gvg): 修改战力相关读取方案
This commit is contained in:
@@ -3,14 +3,14 @@ import { GVGConfigModel, GVGConfigType } from "../../db/GVGConfig";
|
||||
import { getTimeFun, getZeroPoint, getZeroPointOfTime, nowSeconds, WEEK_TO_SECOND } from "../../pubUtils/timeUtil";
|
||||
import { getAllServerCreateTime, getServerCreateTime } from "../redisService";
|
||||
import { GVG_PERIOD, GVG_SERVER_TYPE, SHOP_REFRESH_TYPE } from "../../consts";
|
||||
import { GVGLeagueModel } from "../../db/GVGLeague";
|
||||
import { GVGLeagueModel, GVGLeagueType } from "../../db/GVGLeague";
|
||||
import { GVGLeaguePrepareModel } from "../../db/GVGLeaguePrepare";
|
||||
import { GVGServerGroupModel } from "../../db/GVGServerGroup";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
import { getRandSingleEelm } from "../../pubUtils/util";
|
||||
import { GVG } from "../../pubUtils/dicParam";
|
||||
import { ServerlistModel } from "../../db/Serverlist";
|
||||
import { GuildType } from "../../db/Guild";
|
||||
import { GuildModel, GuildType } from "../../db/Guild";
|
||||
|
||||
// 定时器相关
|
||||
export async function createNewGVGConfig() {
|
||||
@@ -190,4 +190,10 @@ export async function getGVGInfoInGuild(guild: GuildType) {
|
||||
configId, period, countdownTime,
|
||||
type
|
||||
}
|
||||
}
|
||||
|
||||
export async function calLeagueCe(league: GVGLeagueType) {
|
||||
const guildCodes = league?.guildCodes||[];
|
||||
const guilds = await GuildModel.findByCodes(guildCodes);
|
||||
return guilds.reduce((pre, guild) => pre + guild.guildCe, 0);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import { GVG } from "../../pubUtils/dicParam";
|
||||
import { getZeroPointD } from "../../pubUtils/timeUtil";
|
||||
import { resResult } from "../../pubUtils/util";
|
||||
import { sendMessageToUserWithSuc } from "../pushService";
|
||||
import { getCurPeriod, getGVGConfig, getGVGPeriodData, getGVGServerType } from "./gvgService";
|
||||
import { calLeagueCe, getCurPeriod, getGVGConfig, getGVGPeriodData, getGVGServerType } from "./gvgService";
|
||||
|
||||
/**
|
||||
* 自动创建联军
|
||||
@@ -101,10 +101,11 @@ export function getLeagueApplyData(apply: GVGLeagueApplyType, serverNames: any,
|
||||
* @param applies 本军团向其他联军发出的申请
|
||||
* @returns
|
||||
*/
|
||||
export function getLeagueInviteData(invite: GVGLeagueApplyType, serverNames: any, applies: GVGLeagueApplyType[]) {
|
||||
export async function getLeagueInviteData(invite: GVGLeagueApplyType, serverNames: any, applies: GVGLeagueApplyType[]) {
|
||||
let data = new LeagueListInfo(<GVGLeagueType>invite.league, serverNames);
|
||||
let hasApply = !!applies.find(cur => cur.leagueCode == invite.guildCode);
|
||||
data.setHasApply(hasApply);
|
||||
data.setLeagueCe(await calLeagueCe(<GVGLeagueType>invite.league))
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user