feat: mongodb配置更新;在充值action里记录区块链数值,在fundList里乘汇率

This commit is contained in:
chaosBreaking
2019-09-28 13:49:47 +08:00
parent 5fcc65c05e
commit 6f4c73ff35
2 changed files with 4 additions and 3 deletions

View File

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

View File

@@ -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.注入资金