🐞 fix(道具): 获取道具叠加显示

This commit is contained in:
luying
2023-03-16 11:04:28 +08:00
parent 8d0983e02d
commit 81e18e2f87

View File

@@ -38,7 +38,7 @@ export function sortItems(goods: ItemInter[], handleType: HANDLE_REWARD_TYPE) {
}
} else if (table == ITEM_TABLE.ITEM) { // 可叠加道具
let index = items.findIndex(cur => cur.id == good.id);
if(index > 0) {
if(index >= 0) {
items[index].count += good.count;
} else {
items.push({ id: good.id, count: good.count });
@@ -56,7 +56,7 @@ export function sortItems(goods: ItemInter[], handleType: HANDLE_REWARD_TYPE) {
if(dicCurrency) {
if(dicCurrency.type == CURRENCY_TYPE.GOLD) { // 金币,区分付费和免费,默认免费
let index = gold.findIndex(cur => cur.isPay == !!good.isPay);
if(index > 0) {
if(index >= 0) {
gold[index].count += good.count;
} else {
gold.push({ count: good.count, isPay: !!good.isPay });