ss 11 月之前
父節點
當前提交
4451350ae2

+ 16 - 11
application/admin/controller/DailyStatistics.php

@@ -103,22 +103,27 @@ class DailyStatistics extends Auth {
         $map1[] = ['create_time', '>=', $start1];
         $map1[] = ['create_time', '<=', $end1];
         $map[] = ['org_id', '=', $this->orgId];
-        $list = Db::name('daily_record')
-            ->where($map)
-            ->group('daily_id')
-            ->select();
-        foreach ($list as $k => $v) {
-            $list[$k]['title'] = Db::name('daily')
-                ->where('id', $v['daily_id'])
-                ->value('title');
+//        $list = Db::name('daily_record')
+//            ->where($map)
+//            ->group('daily_id')
+//            ->select();
+
+        $addrList =  model('Address')->getListByType(10,$this->orgId);
+        foreach ($addrList as $k => $v) {
+            $dailyIds = Db::name('daily')
+                ->where('enable',1)
+                ->where('del',0)
+                ->where('address_id',$v['id'])
+                ->column('id');
+
             $count = Db::name('daily_record')
                 ->where($map)
-                ->where('daily_id', $v['daily_id'])
+                ->where('daily_id','in', $dailyIds)
                 ->where($map1)
                 ->count();
-            $list[$k]['count'] = $count ? $count : 0;
+            $addrList[$k]['count'] = $count ? $count : 0;
         }
-        $this->assign('list', $list);
+        $this->assign('list', $addrList);
         $this->assign('start', $start);
         $this->assign('end', $end);
         return $this->fetch();

+ 2 - 2
application/admin/view/daily_statistics/daily.html

@@ -35,7 +35,7 @@
                 <table class="table table-bordered">
                     <thead>
                     <tr>
-                        <th>ID</th>
+                        <th>序号</th>
                         <th>任务地点名称</th>
                         <th>工作记录(数量)</th>
                     </tr>
@@ -43,7 +43,7 @@
                     <tbody>
                     {foreach $list as $k=>$v}
                     <tr>
-                        <td>{$v['daily_id']}</td>
+                        <td>{$k+1}</td>
                         <td>{$v['title']}</td>
                         <td>{$v['count']}</td>
                     </tr>

+ 2 - 0
application/common/model/Daily.php

@@ -111,6 +111,7 @@ class Daily extends Base {
     public function sweepCode($orgId,$code, $userId,$taskId=0,$dailyId=0)
     {
         $qrcode_arr = get_qrcode_arr($code);
+
         if(!$qrcode_arr){
             $this->error = '该任务不存在';
             return false;
@@ -131,6 +132,7 @@ class Daily extends Base {
             $addressId = $qrcode_arr['id'];
             $qrcode_arr['id'] =Db::name('daily')
                 ->where('address_id',$addressId)
+                ->where('del',0)
                 ->value('id');
             if(empty($qrcode_arr['id'])){
                 $this->error = '当前地点未绑定日常工作';