🐞 fix(guild): 练兵场-挑战奖励不能重复领取
This commit is contained in:
@@ -65,10 +65,10 @@ export async function getTrainBoxRewardsResult(guildCode: string) {
|
||||
*
|
||||
* @export
|
||||
* @param {string} guildCode
|
||||
* @param {number[]} receivedTrainBox
|
||||
* @param {number[]} receivedTrainBox: {[英雄id]:[军团id]} 表示已经领取过该英雄奖励的军团
|
||||
* @return {*}
|
||||
*/
|
||||
export async function getTrainBoxRewardsResultWithoutAlreadyGeted(guildCode: string, receivedTrainBox:number[]) {
|
||||
export async function getTrainBoxRewardsResultWithoutAlreadyGeted(guildCode: string, receivedTrainBox: { [hid: number]: string[] }) {
|
||||
|
||||
let guildTrains = await GuildTrainModel.findGuildTrain(guildCode);//获得未失效的宝箱奖励
|
||||
let resTrainBoxs = [];
|
||||
@@ -84,9 +84,18 @@ export async function getTrainBoxRewardsResultWithoutAlreadyGeted(guildCode: str
|
||||
if (endTime > nowSeconds())
|
||||
flag = true;
|
||||
}
|
||||
boxRewards.push({ hid, recordBoxs: trainBoxs, trainId, endTime, isComplete });
|
||||
// 在任何军团都未领取过 || 在本军团领取过 ==> 全部正常展示
|
||||
if (!receivedTrainBox[hid] || (receivedTrainBox[hid] && receivedTrainBox[hid].length > 0 && receivedTrainBox[hid].indexOf(guildCode) != -1)) {
|
||||
boxRewards.push({ hid, recordBoxs: trainBoxs, trainId, endTime, isComplete });
|
||||
} else {
|
||||
// 领取过,且不是在本军团领取的 ==> 置灰、奖励不可领取
|
||||
isComplete = false;
|
||||
endTime = 0;
|
||||
boxRewards.push({ hid, recordBoxs: trainBoxs, trainId, endTime, isComplete });
|
||||
}
|
||||
|
||||
});
|
||||
if (flag && (receivedTrainBox.indexOf(trainId) == -1)) {
|
||||
if (flag) {
|
||||
resTrainBoxs.push({ trainId, boxRewards });
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user