hzd 1 mēnesi atpakaļ
vecāks
revīzija
a6f5aa3ce6
1 mainītis faili ar 32 papildinājumiem un 11 dzēšanām
  1. 32 11
      application/api/controller/screen/Patrol.php

+ 32 - 11
application/api/controller/screen/Patrol.php

@@ -92,12 +92,18 @@ class Patrol extends Index
     }
         HelpHander::success($data);
     }
+
     public function newData(){
-        $count1 = Db::name('address')
-            ->where('org_id',$this->orgId)
-            ->where('enable',1)
-            ->where('','exp',Db::raw("FIND_IN_SET(3,types)"))
-            ->count();
+        $map[] = ['cate_id','in',[22,23]];
+        $map[] = ['del','=',0];
+        $map[] = ['enable','=',1];
+        $map[] = ['org_id','=',$this->orgId];
+        $count1 = Db::name('device')->where($map)->count();
+//        $count1 = Db::name('address')
+//            ->where('org_id',$this->orgId)
+//            ->where('enable',1)
+//            ->where('','exp',Db::raw("FIND_IN_SET(3,types)"))
+//            ->count();
         $count2 = Db::name('patrol_task')
             ->alias('pr')
             ->leftJoin('patrol_task_addr b','pr.id=b.patrol_task_id')
@@ -107,19 +113,34 @@ class Patrol extends Index
             ->where('pr.create_yyyymmdd',date('Ymd'))
             ->group('b.address_id')
             ->count();
+//        $count3 = Db::name('user')
+//            ->alias('u')
+//            ->join('user_roles ur','u.id=ur.user_id')
+//            ->where('u.del',0)
+//            ->where('ur.roles_id','in',[464,465,466])
+//            ->count();
         $count3 = Db::name('user')
             ->alias('u')
             ->join('user_roles ur','u.id=ur.user_id')
             ->where('u.del',0)
-            ->where('ur.roles_id','in',[464,465,466])
-            ->count();
-        $count4 = Db::name('user')
-            ->alias('u')
-            ->join('user_roles ur','u.id=ur.user_id')
-            ->where('u.del',0)
             ->where('work',1)
             ->where('ur.roles_id','in',[464,465,466])
             ->count();
+//        $count4 = Db::name('user')
+//            ->alias('u')
+//            ->join('user_roles ur','u.id=ur.user_id')
+//            ->where('u.del',0)
+//            ->where('work',1)
+//            ->where('ur.roles_id','in',[464,465,466])
+//            ->count();
+        $count4 = Db::name('device_record')
+            ->alias('a')
+            ->join('device b','a.device_id = b.id')
+            ->where('b.cate_id','in',[22,23])
+            ->where('a.org_id',$this->orgId)
+            ->where('a.create_yyyymm',date("Ym"))
+            ->count();
+
         $task = Db::name('patrol_task')
             ->where('org_id',$this->orgId)
             ->where('del',0)