From 6b7d95f54864db1b6b5b21e45266c03aed0c4d02 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Fri, 4 Oct 2019 13:44:07 +0800 Subject: [PATCH] fix --- src/modules/fund/fund.controller.js | 2 -- src/modules/fund/fund.handler.js | 5 +++-- src/modules/fund/fund.model.js | 9 ++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/modules/fund/fund.controller.js b/src/modules/fund/fund.controller.js index 7766985..9234cfa 100644 --- a/src/modules/fund/fund.controller.js +++ b/src/modules/fund/fund.controller.js @@ -7,8 +7,6 @@ const { createAction } = require('../action/action.handler'); const { createTicket } = require('../ticket/ticket.handler'); const { deriveNewAccount } = require('../../utils/account'); const { inject } = require('../../common/Provider'); -const ETH = require('../../utils/erc20').ERC20; -const { USDTAddr } = require('../../common/constant'); const { calRevenueLastday, getActiveFund } = require('./fund.handler'); const { getDate } = require('../../utils/date'); const Crypto = require('../../utils/crypto'); diff --git a/src/modules/fund/fund.handler.js b/src/modules/fund/fund.handler.js index 225197f..1cd7789 100644 --- a/src/modules/fund/fund.handler.js +++ b/src/modules/fund/fund.handler.js @@ -8,13 +8,14 @@ const DayLong = 24 * 60 * 60 * 1000; */ class Fund { constructor (data) { - const { amount, blockNumber, hash, blockHash, from, to, timeStamp, value } = data; + const { amount, blockNumber, hash, blockHash, from, to, timeStamp, value, type = 'deposit' } = data; + this.status = 0; + this.type = type; this.amount = +amount; this.from = from; this.to = to; this.value = value; this.timeStamp = timeStamp; - this.status = 0; this.blockNumber = blockNumber; this.blockHash = blockHash; this.hash = hash; diff --git a/src/modules/fund/fund.model.js b/src/modules/fund/fund.model.js index 2649344..48ad97a 100644 --- a/src/modules/fund/fund.model.js +++ b/src/modules/fund/fund.model.js @@ -92,13 +92,7 @@ FundModel.prototype.hasNewDeposit = async function () { /** [addFund] : 向用户添加矿晶,在用户充值USDT时调用!!!! - * 当一个用户充值, - • 4% 给上面第一个 金 或 银 或 铜 会员 - • 3% - • 如果直接上家是金,就全给他; - • 如果直接上家不是金,就平分 3% 给上线所有银会员 - • 2% 给上线所有金会员平分 - */ +、 */ FundModel.prototype.addFund = async function (txlist = [], option) { let newSum = 0; const actionPromiseList = []; @@ -145,6 +139,7 @@ FundModel.prototype.addFund = async function (txlist = [], option) { if (!user && !user.inviter) return 0; const award = +newSum * 0.1; const inviteFund = createNewFund({ + type: 'inviteAward', amount: award, blockNumber: 'followerReward', hash: myId