lrf 2 năm trước cách đây
mục cha
commit
5e3f1050c7
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      app/service/statistics/admin.js

+ 3 - 3
app/service/statistics/admin.js

@@ -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;
     }