From 41b1fe784da199d573c28f1d57a348530c125534 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 8 Feb 2021 13:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E5=93=81=E4=BD=BF=E7=94=A8=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E8=B0=83=E6=95=B4=E5=AD=98=E5=82=A8=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/BagItem.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/models/BagItem.ts b/src/models/BagItem.ts index 8d2ef77..e4e6fb4 100644 --- a/src/models/BagItem.ts +++ b/src/models/BagItem.ts @@ -88,8 +88,13 @@ class BagItemClass extends FindOrCreate { })).doc record.count += item.count await record.save() - await ItemRecord.log(accountid, item.id, item.count, reason, more) results.push(record.toJson()) + setImmediate(function (){ + ItemRecord.log(accountid, item.id, item.count, reason, more) + .then(()=>{}).catch(err=>{ + error('error add item log', err) + }) + }) } return results } @@ -108,7 +113,12 @@ class BagItemClass extends FindOrCreate { const conditions = {accountid, itemid: item.id} const update = {$inc: {count: -item.count}} await BagItem.updateOne(conditions, update) - await ItemRecord.log(accountid, item.id, -item.count, reason, more) + setImmediate(function (){ + ItemRecord.log(accountid, item.id, -item.count, reason, more) + .then(()=>{}).catch(err=>{ + error('error add item log', err) + }) + }) } }