From 81e18e2f870caf65dff3b1091c5872abbe8e5f8f Mon Sep 17 00:00:00 2001 From: luying Date: Thu, 16 Mar 2023 11:04:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E9=81=93=E5=85=B7):=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=81=93=E5=85=B7=E5=8F=A0=E5=8A=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/role/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game-server/app/services/role/util.ts b/game-server/app/services/role/util.ts index 8a5783e18..866fc5206 100644 --- a/game-server/app/services/role/util.ts +++ b/game-server/app/services/role/util.ts @@ -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 });