From 61ba6194626ec1c7266ced03d7fa4c3c2ef87664 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Sun, 8 Sep 2019 21:13:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/fund/fund.controller.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/modules/fund/fund.controller.js b/src/modules/fund/fund.controller.js index 26ac8fb..6bb968c 100644 --- a/src/modules/fund/fund.controller.js +++ b/src/modules/fund/fund.controller.js @@ -210,11 +210,26 @@ module.exports = { data: fund.fundList }); const { hasNew, list } = fund.hasNewDeposit(); - if (!hasNew) return res.json({ - code: 0, - msg: '刷新成功', - data: {} - }); + if (!hasNew) { + const [ start, end ] = getDate(1); + const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: end } }); + // 计算昨日收益 + let revenueLastday = calRevenueLastday(actions); + // 筛选有效矿晶 + let activeFund = getActiveFund(fund.fundList); + return res.json({ + code: 0, + msg: '刷新成功', + data: { + list: fund.fundList, + basic: { + activeFund, + revenueLastday, + revenueAll: fund.fundSum + } + } + }); + } const [ start, end ] = getDate(1); const [newFund, actions] = await Promise.all([ fund.addFund(list, { inviter }),