feat:addFund充值时自动乘以汇率

This commit is contained in:
chaosBreaking
2019-09-28 11:50:38 +08:00
parent 04dcf78cdb
commit 12021334ab
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,5 @@
'use strict';
const DayLong = 24 * 60 * 60 * 1000;
const Rate = 100;
/**
* 资产状态:
* 0 待确认,刚充值的
@@ -57,7 +56,7 @@ module.exports = {
let activeFund = 0;
for (let i = fundList.length; i >= 0; i--) {
const fundItem = fundList[i];
fundItem && (activeFund += fundItem.status === 1 ? +fundItem.amount * Rate : 0);
fundItem && (activeFund += fundItem.status === 1 ? +fundItem.amount : 0);
}
return activeFund;
}

View File

@@ -6,6 +6,8 @@ const { createAction } = require('../action/action.handler');
const { createNewFund } = require('./fund.handler');
const { getNewDepositTx, getUSDTTxList } = require('../../common/deposit');
const USDT2VIC_RATE = 100;
const FundSchema = new mongoose.Schema({
userId: {
type: String
@@ -95,7 +97,7 @@ FundModel.prototype.addFund = async function (txlist = [], option) {
newSum += +txObj.amount;
const action = createAction(0, {
userId: this.userId,
amount: txObj.amount,
amount: +txObj.amount * USDT2VIC_RATE,
tokenType: 'vic', // 目前设定只能挖出矿晶vic
remain: this.asset
});