From fbe60aff85b1c36b43be20d9d84bf9607b8de184 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 1 Feb 2021 11:01:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8A=BD=E5=8D=A1=E6=97=B6,?= =?UTF-8?q?=20=E8=97=8F=E5=AE=9D=E5=9B=BE=E6=95=B0=E9=87=8F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CardController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/CardController.ts b/src/controllers/CardController.ts index 903fad2..9da9f14 100644 --- a/src/controllers/CardController.ts +++ b/src/controllers/CardController.ts @@ -158,7 +158,7 @@ export default class CardController extends BaseController { } } let record = await BagItem.findOne({accountid, itemid}) - if (!record || record.count < count) { + if (!record || record.count < itemInfo[0].count) { throw new ZError(105, '解锁物品数量不足') } const items: ItemInfo[] = [] @@ -234,7 +234,7 @@ export default class CardController extends BaseController { } await BagItem.addItems(accountid, itemToSave) await account.save() - record.count -= count + record.count -= itemInfo[0].count await record.save() return results }