reduce init

This commit is contained in:
chaosBreaking
2019-09-30 13:00:52 +08:00
parent 010257be6d
commit d6dc4fb602

View File

@@ -303,7 +303,7 @@ module.exports = {
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 = 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;
return res.json({
code: 0,