From 742374796793890fdf0713a57712199887e838c4 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Sun, 29 Sep 2019 12:25:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=98=A8=E6=97=A5=E6=94=B6=E7=9B=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/fund/fund.controller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/fund/fund.controller.js b/src/modules/fund/fund.controller.js index e97d221..a20bae8 100644 --- a/src/modules/fund/fund.controller.js +++ b/src/modules/fund/fund.controller.js @@ -245,9 +245,10 @@ module.exports = { }); } const [ start, end ] = getDate(1); + let now = new Date(); const [newFund, actions] = await Promise.all([ fund.addFund(list, { inviter }), - Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: end } }) + Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } }) ]); // 计算昨日收益 let revenueLastday = calRevenueLastday(actions); @@ -285,7 +286,8 @@ module.exports = { const { userId } = res.locals.user; return Fund.findOne({userId}).then(async fund => { const [ start, end ] = getDate(1); - const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: end } }).exec(); + let now = new Date(); + const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } }).exec(); // 计算昨日收益 let revenueLastday = calRevenueLastday(actions); // 筛选有效矿晶