lrf402788946 il y a 4 ans
Parent
commit
f950486e29
1 fichiers modifiés avec 14 ajouts et 5 suppressions
  1. 14 5
      app/service/statistics.js

+ 14 - 5
app/service/statistics.js

@@ -145,19 +145,28 @@ class IndexService extends CrudService {
     const res = await this.ctx.model.Ticket.aggregate([
       { $group: {
         _id: '$status',
-        count: { $sum: 1 },
+        value: { $sum: 1 },
       } },
     ]);
-
     const data = statusList.map(i => {
-      const { label, value } = i;
+      const { label: name, value } = i;
       const r = res.find(f => f._id === value);
-      const obj = { label, value: 0 };
+      const obj = { name, value: 0 };
       if (r) obj.value = r.value;
       return obj;
     });
-    return data;
+    // 政策服务
+    // 高企认定(ticket);奖励兑现(policy);研发补贴(policy)
+    const tcount = await this.ctx.model.Ticket.count();
+    const jldx = await this.ctx.model.Policy.count({ type: '奖励兑现' });
+    const yfbt = await this.ctx.model.Policy.count({ type: '研发补贴' });
+    const arr = [];
+    arr.push({ name: '高企认定', value: tcount });
+    arr.push({ name: '奖励兑现', value: jldx });
+    arr.push({ name: '研发补贴', value: yfbt });
+    return { ticket: data, policy: arr };
   }
+
 }
 
 module.exports = IndexService;