lrf 2 tahun lalu
induk
melakukan
7953b3b42b
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      app/service/statistics/admin.js

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

@@ -124,14 +124,14 @@ class AdminService extends CrudService {
     } else timeRange = this.getDefaultRange(type);
     // 先用商店过滤下
     if (ObjectId.isValid(shop)) {
-      pipline.push({ $match: { shop } });
+      pipline.push({ $match: { 'goods.shop': shop } });
     }
     if (status) {
       pipline.push({ $match: { status } });
     }
     // 时间格式化: create_date:日期,用来分组统计; create_time: 时间,用来过滤数据
     pipline.push({
-      $project: {
+      $addFields: {
         create_date: { $dateToString: { date: '$meta.createdAt', ...this.pipDateFormatDateObject() } },
         create_time: { $dateToString: { date: '$meta.createdAt', ...this.pipDateFormatTimeObject() } },
       },