物品使用记录调整存储优先级

This commit is contained in:
zhl 2021-02-08 13:52:45 +08:00
parent 3c6af39317
commit 41b1fe784d

View File

@ -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)
})
})
}
}