🐞 fix(guild): 修复周一加入无活人军团领奖励问题
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
||||
import { getArmyTrainJuDian, getGuildTrainGkInfo, getTrainBaseByLv } from '../pubUtils/data';
|
||||
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
||||
import { nowSeconds, getZeroPoint, isToday, getSeconds } from '../pubUtils/timeUtil';
|
||||
import { GUILD_STRUCTURE, PUSH_ROUTE } from '../consts';
|
||||
import { GuildTrainType, GuildTrainModel, TrainInstance } from '../db/GuildTrain';
|
||||
import { GuildModel, GuildType } from '../db/Guild';
|
||||
@@ -165,11 +165,16 @@ export async function resetTrain(code: string, serverId: number) {
|
||||
if (!guild) {//不满足重置条件,结束并解锁
|
||||
return trainId;
|
||||
}
|
||||
const userGuildList = await UserGuildModel.getListByGuild(code, 'trainRewards roleId', {});
|
||||
const userGuildList = await UserGuildModel.getListByGuild(code, 'trainRewards roleId createdAt', {});
|
||||
const guildTrains = await GuildTrainModel.getGuildTrainBoxs(code);
|
||||
|
||||
//结算未领取的宝箱奖励发送到邮件中
|
||||
userGuildList.forEach(async function ({roleId, trainRewards}) {
|
||||
userGuildList.forEach(async function ({roleId, trainRewards, createdAt}) {
|
||||
if (isToday(getSeconds(createdAt))) {
|
||||
// 此处发放的奖励是昨天该军团的奖励
|
||||
// 今天加入军团的玩家,不发放
|
||||
return;
|
||||
}
|
||||
let goods: { id: number, count: number }[] = [];
|
||||
guildTrains.forEach(guildTrain=>{
|
||||
guildTrain.trainInstances.forEach(({ trainBoxs, hid })=>{
|
||||
|
||||
Reference in New Issue
Block a user