|
@@ -136,7 +136,7 @@ class AdminService extends CrudService {
|
|
|
create_time: { $dateToString: { date: '$meta.createdAt', ...this.pipDateFormatTimeObject() } },
|
|
|
},
|
|
|
});
|
|
|
- pipline.push({ $match: { $and: [{ create_time: { $gte: _.head(timeRange) } }, { create_time: { $lte: _.last(timeRange) } }] } });
|
|
|
+ pipline.push({ $match: { $and: [{ buy_time: { $gte: _.head(timeRange) } }, { buy_time: { $lte: _.last(timeRange) } }] } });
|
|
|
pipline.push({
|
|
|
$group: {
|
|
|
_id: '$create_date',
|
|
@@ -216,7 +216,7 @@ class AdminService extends CrudService {
|
|
|
} else timeRange = this.getDefaultRange(type);
|
|
|
// 先用商店过滤下
|
|
|
if (ObjectId.isValid(shop)) {
|
|
|
- pipline.push({ $match: { shop } });
|
|
|
+ pipline.push({ $match: { 'goods.shop': shop } });
|
|
|
}
|
|
|
pipline.push({ $match: { status: '1' } });
|
|
|
// 时间格式化: create_date:日期,用来分组统计; create_time: 时间,用来过滤数据
|
|
@@ -240,7 +240,7 @@ class AdminService extends CrudService {
|
|
|
for (const d of list) {
|
|
|
const r = fs.find(f => f._id === d);
|
|
|
const obj = { date: d, money: 0 };
|
|
|
- if (r) obj.money = r.money;
|
|
|
+ if (r) obj.money = this.ctx.toNumber(r.money);
|
|
|
result.push(obj);
|
|
|
if (type === 'day') break;
|
|
|
}
|