Browse Source

1、抽红包次数统计;

Lawsun_M 1 year ago
parent
commit
d301a9f473
1 changed files with 14 additions and 2 deletions
  1. 14 2
      app/service/manager.js

+ 14 - 2
app/service/manager.js

@@ -47,7 +47,7 @@ module.exports = class ManagerService extends BaseService {
     let result = [];
     const options = {
       attributes: [ 'access_id', 'access_name', 'access_icon', 'pid', 'is_nav', 'router_name', 'router_path', 'vuecomponent', 'mobile_show' ],
-      raw: true, where: { access_status: 1 }, order: [[ 'access_sort', 'asc' ], [ 'access_id', 'asc' ]],
+      raw: true, where: { access_status: 1 }, order: [ [ 'access_sort', 'asc' ], [ 'access_id', 'asc' ] ],
     };
     if (mobile) options.where.mobile_show = 1;
     const access = await that.app.model.Accesss.findAll(options);
@@ -164,17 +164,29 @@ module.exports = class ManagerService extends BaseService {
         update_ttime: { [seq.Op.between]: [ times[day - 1][0], times[0][1] ] },
       }, raw: true,
     });
+    const luckyMoney = await that.app.model.UsersMoneyLogs.findAll({
+      where: {
+        change_time: { [seq.Op.between]: [ times[day - 1][0], times[0][1] ] },
+        type: 4,
+      }, raw: true,
+    });
     const result = [];
     times.forEach(item => {
       const startTime = that.app.szjcomo.strToTime(item[0]);
       const endTime = that.app.szjcomo.strToTime(item[1]);
-      const tmpData = { date: that.app.szjcomo.date('m-d', startTime), count: 0 };
+      const tmpData = { date: that.app.szjcomo.date('m-d', startTime), count: 0, luckyCount: 0 };
       users.forEach(childItem => {
         const tmpTime = that.app.szjcomo.strToTime(childItem.update_ttime);
         if (tmpTime >= startTime && tmpTime <= endTime) {
           tmpData.count += 1;
         }
       });
+      luckyMoney.forEach(childItem => {
+        const tmpTime = that.app.szjcomo.strToTime(childItem.change_time);
+        if (tmpTime >= startTime && tmpTime <= endTime) {
+          tmpData.luckyCount += 1;
+        }
+      });
       result.push(tmpData);
     });
     return result;