From 6f4c73ff35eef2e48061c807e08e4a2d3157da31 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Sat, 28 Sep 2019 13:49:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mongodb=E9=85=8D=E7=BD=AE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=9B=E5=9C=A8=E5=85=85=E5=80=BCaction=E9=87=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=8C=BA=E5=9D=97=E9=93=BE=E6=95=B0=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8fundList=E9=87=8C=E4=B9=98=E6=B1=87=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/dbConnect.js | 3 ++- src/modules/fund/fund.model.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/dbConnect.js b/src/common/dbConnect.js index 3d2e713..3ae6e29 100644 --- a/src/common/dbConnect.js +++ b/src/common/dbConnect.js @@ -25,7 +25,8 @@ module.exports = inject(async function connect2db(SysConfig) { useNewUrlParser: true, bufferMaxEntries: 0, autoReconnect: true, - useFindAndModify: false + useFindAndModify: false, + useUnifiedTopology: true }); return db; }); diff --git a/src/modules/fund/fund.model.js b/src/modules/fund/fund.model.js index 2206bf0..da83ab0 100644 --- a/src/modules/fund/fund.model.js +++ b/src/modules/fund/fund.model.js @@ -95,15 +95,15 @@ FundModel.prototype.addFund = async function (txlist = [], option) { const actionPromiseList = []; const newFundList = txlist.map(txObj => { const depositAmount = +txObj.amount * USDT2VIC_RATE; - txObj.amount = depositAmount; // 把区块链的数值乘以比率 !!!! newSum += depositAmount; const action = createAction(0, { userId: this.userId, - amount: depositAmount, + amount: +txObj.amount, // 充值记录的数值仍然是区块链的数值 tokenType: 'vic', // 目前设定只能挖出矿晶vic remain: this.asset }); actionPromiseList.push(action.save()); + txObj.amount = depositAmount; // 之后返回fundList里的数值需要把区块链的数值乘以比率 !!!! return createNewFund(txObj); }); // 1.注入资金