fix: 昨日

This commit is contained in:
chaosBreaking
2019-09-29 12:29:41 +08:00
parent 7423747967
commit d15ef1bf7e

View File

@@ -224,9 +224,11 @@ module.exports = {
data: fund.fundList data: fund.fundList
}); });
const { hasNew, list } = await fund.hasNewDeposit(); const { hasNew, list } = await fund.hasNewDeposit();
const [ start, end ] = getDate(1);
let now = new Date();
if (!hasNew) { if (!hasNew) {
const [ start, end ] = getDate(1); // const [ start, end ] = getDate(1);
const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: end } }); const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } });
// 计算昨日收益 // 计算昨日收益
let revenueLastday = calRevenueLastday(actions); let revenueLastday = calRevenueLastday(actions);
// 筛选有效矿晶 // 筛选有效矿晶
@@ -244,8 +246,6 @@ module.exports = {
} }
}); });
} }
const [ start, end ] = getDate(1);
let now = new Date();
const [newFund, actions] = await Promise.all([ const [newFund, actions] = await Promise.all([
fund.addFund(list, { inviter }), fund.addFund(list, { inviter }),
Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } }) Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } })