From 1dc5d4e2847f839a0f901adbfa72db3114868189 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Mon, 7 Oct 2019 17:12:24 +0800 Subject: [PATCH] fix fund --- src/modules/fund/fund.handler.js | 5 +++-- src/modules/fund/fund.model.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/fund/fund.handler.js b/src/modules/fund/fund.handler.js index 1cd7789..0bb41cf 100644 --- a/src/modules/fund/fund.handler.js +++ b/src/modules/fund/fund.handler.js @@ -8,13 +8,13 @@ const DayLong = 24 * 60 * 60 * 1000; */ class Fund { constructor (data) { - const { amount, blockNumber, hash, blockHash, from, to, timeStamp, value, type = 'deposit' } = data; + const { amount, blockNumber, hash = '', blockHash = '', from = '', to = '', timeStamp, usdtValue = 0, type = 'deposit' } = data; this.status = 0; this.type = type; this.amount = +amount; this.from = from; this.to = to; - this.value = value; + this.usdtValue = usdtValue; this.timeStamp = timeStamp; this.blockNumber = blockNumber; this.blockHash = blockHash; @@ -24,6 +24,7 @@ class Fund { this.createdAt = now.toISOString(); this.expiresAt = new Date(now.getTime() + exp * DayLong); this.releasedAmout = 0; + this.rawData = data; } } const calExpirePeriod = () => 50; diff --git a/src/modules/fund/fund.model.js b/src/modules/fund/fund.model.js index 48ad97a..4c76f43 100644 --- a/src/modules/fund/fund.model.js +++ b/src/modules/fund/fund.model.js @@ -97,6 +97,7 @@ FundModel.prototype.addFund = async function (txlist = [], option) { let newSum = 0; const actionPromiseList = []; const newFundList = txlist.map(txObj => { + txObj.usdtValue = txObj.amount; const depositAmount = +txObj.amount * USDT2VIC_RATE; newSum += depositAmount; const action = createAction(0, {