lrf 2 年之前
父节点
当前提交
4fcac5ae4b
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      app/service/statistics.js

+ 11 - 2
app/service/statistics.js

@@ -20,6 +20,15 @@ class StatisticsService extends CrudService {
     const rList = await this.rcsModel.find({ school_id }).populate('coach_id', 'name');
     const coachList = rList.map(i => i.coach_id);
     const lcList = await this.lessonCoachModel.find({ school_id }, { coach_id: 1, is_sign: 1 });
+    const midList = _.groupBy(lcList, 'coach_id');
+    for (const coach_id in midList) {
+      const l = midList[coach_id];
+      midList[coach_id] = _.groupBy(l, 'is_sign');
+      for (const is_sign in midList[coach_id]) {
+        midList[coach_id][is_sign] = midList[coach_id][is_sign].length;
+      }
+    }
+    console.log(midList);
   }
 
 
@@ -115,7 +124,7 @@ class StatisticsService extends CrudService {
       }
       xList = xList.map(i => {
         const { date } = this.getPartsOfNow(i);
-        return date;
+        return `${date}日`;
       });
     } else if ([ '3m', '6m', '1y' ].includes(time)) {
       for (const x of xList) {
@@ -132,7 +141,7 @@ class StatisticsService extends CrudService {
       }
       xList = xList.map(i => {
         const { month } = this.getPartsOfNow(i);
-        return parseInt(month);
+        return `${parseInt(month)}月`;
       });
       xList = _.reverse(xList);
     }