This commit is contained in:
chaosBreaking
2019-10-04 13:44:07 +08:00
parent 06763ca752
commit 6b7d95f548
3 changed files with 5 additions and 11 deletions

View File

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

View File

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

View File

@@ -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