From 92fe47c44168446969a99649552fd7492226e5e4 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Mon, 7 Oct 2019 17:30:40 +0800 Subject: [PATCH] =?UTF-8?q?fund=20hash=E6=94=B9=E5=90=8DtxHash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/fund/fund.handler.js | 4 ++-- src/modules/fund/fund.model.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/fund/fund.handler.js b/src/modules/fund/fund.handler.js index 0bb41cf..a834e57 100644 --- a/src/modules/fund/fund.handler.js +++ b/src/modules/fund/fund.handler.js @@ -7,7 +7,7 @@ const DayLong = 24 * 60 * 60 * 1000; * 2 不可用,已耗尽 */ class Fund { - constructor (data) { + constructor (data = {}) { const { amount, blockNumber, hash = '', blockHash = '', from = '', to = '', timeStamp, usdtValue = 0, type = 'deposit' } = data; this.status = 0; this.type = type; @@ -18,7 +18,7 @@ class Fund { this.timeStamp = timeStamp; this.blockNumber = blockNumber; this.blockHash = blockHash; - this.hash = hash; + this.txHash = hash; const now = new Date(); const exp = calExpirePeriod(); this.createdAt = now.toISOString(); diff --git a/src/modules/fund/fund.model.js b/src/modules/fund/fund.model.js index 4c76f43..e584f6f 100644 --- a/src/modules/fund/fund.model.js +++ b/src/modules/fund/fund.model.js @@ -108,7 +108,8 @@ FundModel.prototype.addFund = async function (txlist = [], option) { }); typeof action.save === 'function' && actionPromiseList.push(action.save()); txObj.amount = depositAmount; // 之后返回fundList里的数值需要把区块链的数值乘以比率 !!!! - return createNewFund(txObj); + mylog.info(txObj); + return createNewFund({...txObj}); }); // 1.注入资金 const res = await FundModel.findByIdAndUpdate(this.id, {