更新countAction值;前端送来的Amount要确保转成Number

This commit is contained in:
陆柯 2020-02-29 15:31:36 +08:00
parent fa9980b45a
commit 7f1cd4199a

View File

@ -25,9 +25,9 @@ MOM.executableMe = async function() {
MOM.executeMe = async function () {
let sender= await wo.Account.getOne({Account: { address: this.actorAddress }})
if (sender && sender.type !== 'multisig' && this.toAddress != this.actorAddress && sender.balance >= this.amount + this.fee){
await sender.setMe({Account:{ balance: sender.balance-this.amount-this.fee }, cond:{ address:sender.address}})
await sender.setMe({Account:{ balance: Number(sender.balance)-Number(this.amount)-Number(this.fee), countAction: sender.countAction+1 }, cond:{ address:sender.address}})
let getter= await wo.Account.getOne({Account: { address: this.toAddress }}) || await wo.Account.addOne({Account: { address: this.toAddress }})
await getter.setMe({Account:{ balance: getter.balance+this.amount }, cond:{ address:getter.address}})
await getter.setMe({Account:{ balance: Number(getter.balance)+Number(this.amount), countAction: getter.countAction+1 }, cond:{ address:getter.address}})
mylog.info('Excecuted action='+JSON.stringify(this))
return this
}