红点:添加试炼宝箱
This commit is contained in:
@@ -35,6 +35,31 @@ export async function getUserGuild(roleId: string, serverId: number) {
|
||||
return userGuild;
|
||||
}
|
||||
|
||||
export async function getTrainBoxRewardsResult(guildCode: string) {
|
||||
|
||||
let guildTrains = await GuildTrainModel.findGuildTrain(guildCode);//获得未失效的宝箱奖励
|
||||
let resTrainBoxs = [];
|
||||
guildTrains.forEach(({ trainInstances, trainId }) => {
|
||||
let { trainInstances: instances } = getArmyTrainJuDian(trainId);
|
||||
let flag = false;
|
||||
let boxRewards = [];
|
||||
trainInstances.map(({ hid, progress, endTime, trainBoxs }) => {
|
||||
let isComplete = false;
|
||||
let instance = findWhere(instances, { hid });
|
||||
if (progress >= instance.progress) {
|
||||
isComplete = true;
|
||||
if (endTime > nowSeconds())
|
||||
flag = true;
|
||||
}
|
||||
boxRewards.push({ hid, recordBoxs: trainBoxs, trainId, endTime, isComplete });
|
||||
});
|
||||
if (flag) {
|
||||
resTrainBoxs.push({ trainId, boxRewards });
|
||||
}
|
||||
})
|
||||
return resTrainBoxs
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得未失效的试炼宝箱奖励
|
||||
* @param guildTrain
|
||||
|
||||
Reference in New Issue
Block a user