From d6dc4fb602502827d31f2267b192e5c67e1e8ec3 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Mon, 30 Sep 2019 13:00:52 +0800 Subject: [PATCH] reduce init --- src/modules/fund/fund.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fund/fund.controller.js b/src/modules/fund/fund.controller.js index 7463dd8..4884464 100644 --- a/src/modules/fund/fund.controller.js +++ b/src/modules/fund/fund.controller.js @@ -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,