소스 검색

全流程巡检接口

任敬轩 4 달 전
부모
커밋
5aa133ec1e
1개의 변경된 파일11개의 추가작업 그리고 25개의 파일을 삭제
  1. 11 25
      Modules/Camera/Http/Controllers/Api/CameraApiController.php

+ 11 - 25
Modules/Camera/Http/Controllers/Api/CameraApiController.php

@@ -84,39 +84,25 @@ class CameraApiController extends BaseController
         //宁煤集团
         $ningmei = DB::table('mine_list')->where('title',config('mine_hls'))->get();
 
-        $ydjk = DB::table('mine_list')->where('title','移动监控')->where('deleted_at',null)->get();
-        $ydjk_list = [];
-        if(count($ydjk) > 0){
-            for($i=0;$i<count($ydjk);$i++){
-                array_push($ydjk_list,$ydjk[$i]->id);
-
-            }
-        }
-        $ydjk_son = DB::table('mine_list')->whereIn('parent_id',$ydjk_list)->where('deleted_at',null)->get();
-        if(count($ydjk_son) > 0){
-            for($i=0;$i<count($ydjk_son);$i++){
-                array_push($ydjk_list,$ydjk_son[$i]->id);
-
-            }
-        }
+        $mine_all = DB::table('mine_list')->where('deleted_at',null);
 
-        $xczyd = DB::table('mine_list')->where('title','现场作业点')->where('deleted_at',null)->get();
-        $xczyd_list = [];
+        $xczyd = DB::table('mine_list')->where('deleted_at',null)->where('title','现场作业点')->pluck('degree');
+        $ydjk = DB::table('mine_list')->where('deleted_at',null)->where('title','移动监控')->pluck('degree');
         if(count($xczyd) > 0){
             for($i=0;$i<count($xczyd);$i++){
-                array_push($xczyd_list,$xczyd[$i]->id);
-
+                $mine_all->where('degree','not like',$xczyd[$i].'%');
             }
         }
-        $xczyd_son = DB::table('mine_list')->whereIn('parent_id',$xczyd_list)->where('deleted_at',null)->get();
-        if(count($xczyd_son) > 0){
-            for($i=0;$i<count($xczyd_son);$i++){
-                array_push($xczyd_list,$xczyd_son[$i]->id);
-
+        if(count($ydjk) > 0){
+            for($i=0;$i<count($ydjk);$i++){
+                $mine_all->where('degree','not like',$ydjk[$i].'%');
             }
         }
 
-        $mine_all = DB::table('mine_list')->where('deleted_at',null)->whereNotIn('id',$ydjk_list)->whereNotIn('id',$xczyd_list)->get();//所有区域
+        $mine_all = $mine_all->get();
+
+//        $mine_all = DB::table('mine_list')->where('deleted_at',null)->whereNotIn('id',$ydjk_list)->whereNotIn('id',$xczyd_list)->get();//所有区域
+//        $mine_all = DB::table('mine_list')->where('deleted_at',null)->where('degree','not like','968|2447|5784%')->where('degree','not like','968|2525|6477%')->where('degree','not like','968|2576|6825%')->where('degree','not like','968|2576|6808%')->get();//所有区域
 
         $mine_ningmei = [];//宁煤集团所有区域
         foreach($mine_all as $k=>$v){