fix: 累计收益
This commit is contained in:
@@ -295,12 +295,14 @@ module.exports = {
|
||||
return Fund.findOne({userId}).then(async fund => {
|
||||
const [ start, end ] = getDate(1);
|
||||
let now = new Date();
|
||||
const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } }).exec();
|
||||
// 计算昨日收益
|
||||
let revenueLastday = calRevenueLastday(actions);
|
||||
// 筛选有效矿晶
|
||||
let activeFund = getActiveFund(fund.fundList);
|
||||
const revenueAll = fund.asset && +fund.asset['vic'] || 0;
|
||||
const actions = await Action.find({ userId, type: 1, createdAt: { $gt: start, $lt: now } }).exec();
|
||||
const allAction = await Action.find({ userId, type: 1 }).exec();
|
||||
// 计算昨日收益
|
||||
let revenueLastday = calRevenueLastday(actions);
|
||||
const revenueAll = Array.isArray(allAction) && allAction.reduce((pre, cur) => (pre.amount && +pre.amount || 0) + (pre.amount && +cur.amount || 0)) || 0;
|
||||
// const revenueAll = fund.asset && +fund.asset['vic'] || 0;
|
||||
return res.json({
|
||||
code: 0,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user