获得试炼奖励

This commit is contained in:
mamengke01
2021-02-02 14:41:10 +08:00
parent ec870dbd2e
commit 5da98956b9
7 changed files with 64 additions and 27 deletions

View File

@@ -79,11 +79,10 @@ export class GuildTrainHandler {
const { guildCode: code } = userGuild;
let guildTrains = await GuildTrainModel.findGuildTrain(code);
let resTrainBoxs = [];
let { trainId: curTrainId } = await GuildModel.findGuild(code, serverId, 'trainId');
guildTrains.forEach(({trainInstances, trainId}) =>{
let { trainInstances: instances } = getArmyTrainJuDian(trainId);
let flag = false;
let boxRewards = []
let boxRewards = [];
trainInstances.map(({hid, progress, endTime, trainBoxs})=>{
let instance = findWhere(instances, { hid });
let isComplete = false;
@@ -93,11 +92,11 @@ export class GuildTrainHandler {
flag = true;
boxRewards.push({hid, recordBoxs: trainBoxs, trainId, endTime, isComplete});
});
if (flag || trainId == curTrainId) {
resTrainBoxs.push(...boxRewards);
if (flag) {
resTrainBoxs.push({ trainId, boxRewards });
}
})
return resResult(STATUS.SUCCESS, {trainBoxs: resTrainBoxs});
return resResult(STATUS.SUCCESS, {trainBoxRewards: resTrainBoxs});
}
async trainBattleStart(msg: { hid: number, trainId: number, difficulty: number }, session: BackendSession) {