This commit is contained in:
chaosBreaking
2019-10-07 17:12:24 +08:00
parent 19a1915686
commit 1dc5d4e284
2 changed files with 4 additions and 2 deletions

View File

@@ -8,13 +8,13 @@ const DayLong = 24 * 60 * 60 * 1000;
*/
class Fund {
constructor (data) {
const { amount, blockNumber, hash, blockHash, from, to, timeStamp, value, type = 'deposit' } = data;
const { amount, blockNumber, hash = '', blockHash = '', from = '', to = '', timeStamp, usdtValue = 0, type = 'deposit' } = data;
this.status = 0;
this.type = type;
this.amount = +amount;
this.from = from;
this.to = to;
this.value = value;
this.usdtValue = usdtValue;
this.timeStamp = timeStamp;
this.blockNumber = blockNumber;
this.blockHash = blockHash;
@@ -24,6 +24,7 @@ class Fund {
this.createdAt = now.toISOString();
this.expiresAt = new Date(now.getTime() + exp * DayLong);
this.releasedAmout = 0;
this.rawData = data;
}
}
const calExpirePeriod = () => 50;

View File

@@ -97,6 +97,7 @@ FundModel.prototype.addFund = async function (txlist = [], option) {
let newSum = 0;
const actionPromiseList = [];
const newFundList = txlist.map(txObj => {
txObj.usdtValue = txObj.amount;
const depositAmount = +txObj.amount * USDT2VIC_RATE;
newSum += depositAmount;
const action = createAction(0, {