reduce init
This commit is contained in:
@@ -303,7 +303,7 @@ module.exports = {
|
|||||||
const allAction = await Action.find({ userId, type: 1 }).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;
|
const revenueAll = Array.isArray(allAction) && allAction.reduce((pre, cur) => (pre.amount && +pre.amount || 0) + (pre.amount && +cur.amount || 0), 0) || 0;
|
||||||
// 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,
|
||||||
|
|||||||
Reference in New Issue
Block a user