|
@@ -15,10 +15,11 @@ class CashBackService extends CrudService {
|
|
async computedTotal({ customer }) {
|
|
async computedTotal({ customer }) {
|
|
assert(customer, '缺少用户信息');
|
|
assert(customer, '缺少用户信息');
|
|
const res = await this.model.find({ inviter: customer });
|
|
const res = await this.model.find({ inviter: customer });
|
|
|
|
+ console.log(res);
|
|
const total = res.reduce((p, n) => {
|
|
const total = res.reduce((p, n) => {
|
|
- let point = n.point;
|
|
|
|
- if (!(n.source === '0' || n.source === '1')) point = -point;
|
|
|
|
- return this.ctx.plus(p, point);
|
|
|
|
|
|
+ let money = n.money;
|
|
|
|
+ if (!(n.source === '0' || n.source === '1')) money = -money;
|
|
|
|
+ return this.ctx.plus(p, money);
|
|
}, 0);
|
|
}, 0);
|
|
return total;
|
|
return total;
|
|
}
|
|
}
|