feat:addFund充值时自动乘以汇率
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const DayLong = 24 * 60 * 60 * 1000;
|
const DayLong = 24 * 60 * 60 * 1000;
|
||||||
const Rate = 100;
|
|
||||||
/**
|
/**
|
||||||
* 资产状态:
|
* 资产状态:
|
||||||
* 0 待确认,刚充值的
|
* 0 待确认,刚充值的
|
||||||
@@ -57,7 +56,7 @@ module.exports = {
|
|||||||
let activeFund = 0;
|
let activeFund = 0;
|
||||||
for (let i = fundList.length; i >= 0; i--) {
|
for (let i = fundList.length; i >= 0; i--) {
|
||||||
const fundItem = fundList[i];
|
const fundItem = fundList[i];
|
||||||
fundItem && (activeFund += fundItem.status === 1 ? +fundItem.amount * Rate : 0);
|
fundItem && (activeFund += fundItem.status === 1 ? +fundItem.amount : 0);
|
||||||
}
|
}
|
||||||
return activeFund;
|
return activeFund;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ const { createAction } = require('../action/action.handler');
|
|||||||
const { createNewFund } = require('./fund.handler');
|
const { createNewFund } = require('./fund.handler');
|
||||||
const { getNewDepositTx, getUSDTTxList } = require('../../common/deposit');
|
const { getNewDepositTx, getUSDTTxList } = require('../../common/deposit');
|
||||||
|
|
||||||
|
const USDT2VIC_RATE = 100;
|
||||||
|
|
||||||
const FundSchema = new mongoose.Schema({
|
const FundSchema = new mongoose.Schema({
|
||||||
userId: {
|
userId: {
|
||||||
type: String
|
type: String
|
||||||
@@ -95,7 +97,7 @@ FundModel.prototype.addFund = async function (txlist = [], option) {
|
|||||||
newSum += +txObj.amount;
|
newSum += +txObj.amount;
|
||||||
const action = createAction(0, {
|
const action = createAction(0, {
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
amount: txObj.amount,
|
amount: +txObj.amount * USDT2VIC_RATE,
|
||||||
tokenType: 'vic', // 目前设定只能挖出矿晶vic
|
tokenType: 'vic', // 目前设定只能挖出矿晶vic
|
||||||
remain: this.asset
|
remain: this.asset
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user