活动:新将抽卡添加固定奖励

This commit is contained in:
qiaoxin
2021-06-24 15:49:40 +08:00
parent 51b96a6853
commit d906392764
6 changed files with 37 additions and 14 deletions

View File

@@ -93,7 +93,18 @@ export async function addReward(roleId: string, roleName: string, sid: string, s
goods = goods.concat(heroResult.goods)
addHeros = addHeros.concat(heroResult.heroes);
}
return { goods, addHeros }
let newGoods: RewardInter[] = [];
for (let item of goods) {
let index = newGoods.findIndex(obj => { return obj.id == item.id });
if (index != -1) {
newGoods[index].count += item.count;
} else {
newGoods.push({ id: item.id, count: item.count })
}
}
return { goods: newGoods, addHeros }
}
//表中的奖励数据(包括礼包)转换成具体对应奖励物品的实例