From 522c4fd1216f67c364430447d49c563777765ccc Mon Sep 17 00:00:00 2001 From: dingchaolin Date: Tue, 14 Mar 2023 14:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(guild):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=86=9B=E5=9B=A2=E8=AF=95=E7=82=BC=E5=A5=96=E5=8A=B1=E5=A4=9A?= =?UTF-8?q?=E5=8F=91=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/guildTrainService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/game-server/app/services/guildTrainService.ts b/game-server/app/services/guildTrainService.ts index f76b389c1..4244dcdee 100644 --- a/game-server/app/services/guildTrainService.ts +++ b/game-server/app/services/guildTrainService.ts @@ -17,6 +17,7 @@ import { sendMailByContent } from './mailService'; import { MAIL_TYPE } from '../consts'; import { getGuildChannelSid } from './chatChannelService'; import { sendMessageToGuildWithSuc } from './pushService'; +import { gameData } from '../pubUtils/data'; /** * 获得userGuild,并检查,是否需要每日重置购买挑战次数和今日挑战次数,已经检查是否需要每周重置练兵场 * @param roleId @@ -185,6 +186,8 @@ export async function resetTrain(code: string, serverId: number) { if (!!res.err) return; let { structure, trainId, resetTrainTimeDaily } = await GuildModel.findGuild(code, serverId, 'structure trainId resetTrainTimeDaily'); + // 上周试炼到的trainId + const currentTrainId = trainId; // if(trainId && shouldRefresh(resetTrainTimeDaily, new Date())) { // let { trainInstances } = getArmyTrainJuDian(trainId); // // 初始化 @@ -210,6 +213,7 @@ export async function resetTrain(code: string, serverId: number) { const userGuildList = await UserGuildModel.getListByGuild(code, 'trainRewards roleId createdAt', {}); const guildTrains = await GuildTrainModel.getGuildTrainBoxs(code); + const minTrainIdOfCurrentLv = gameData.firstGuildTrainIdOfLv.get(lv); //结算未领取的宝箱奖励发送到邮件中 userGuildList.forEach(async function ({roleId, trainRewards, createdAt}) { if (getZeroPoint(SHOP_REFRESH_TYPE.WEEKLY) < getSeconds(createdAt)) { @@ -227,7 +231,7 @@ export async function resetTrain(code: string, serverId: number) { }) }); - for (let trainId = 1; trainId < guild.trainId; trainId++) { + for (let trainId = minTrainIdOfCurrentLv; trainId < currentTrainId; trainId++) { let { jinjieReward } = getArmyTrainJuDian(trainId); if (trainRewards.indexOf(trainId) === -1) { goods.push(...jinjieReward);