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