Browse Source

摄像头同步修改

任敬轩 3 years ago
parent
commit
0bc239afa0
1 changed files with 29 additions and 2 deletions
  1. 29 2
      app/Console/Commands/UpdateHkList.php

+ 29 - 2
app/Console/Commands/UpdateHkList.php

@@ -70,7 +70,8 @@ class UpdateHkList extends Command
             ->where('mine_list_ext.ip','!=','')
             ->where('mine_list_ext.port','!=','')
             ->where('mine_list_ext.key','!=','')
-            ->where('mine_list_ext.secret','!=','')->get();
+            ->where('mine_list_ext.secret','!=','')
+            ->where('mine_list_ext.deleted_at',null)->get();
 
         if(sizeof($mine_list_ext)>0){
             for($i=0;$i<sizeof($mine_list_ext);$i++){//循环同步所有天地伟业矿区
@@ -101,6 +102,31 @@ class UpdateHkList extends Command
         //查询存在index_code列表
         $index_code_list = MineList::where('index_code', '!=', null)->get();
 
+        //天地伟业矿区
+        $mine_ext = DB::table('mine_list_ext')
+            ->select('mine_list_ext.*','mine_list.parent_id')
+            ->leftJoin('mine_list','mine_list.id','=','mine_list_ext.mine_id')
+            ->where('mine_list.parent_id',0)
+            ->where('mine_list_ext.is_hak',MineEnum::IS_HAK_TD)
+            ->where('mine_list_ext.ip','!=','')
+            ->where('mine_list_ext.port','!=','')
+            ->where('mine_list_ext.key','!=','')
+            ->where('mine_list_ext.secret','!=','')
+            ->where('mine_list_ext.deleted_at',null)->get();
+
+        $mine_id_list = [];
+        foreach($mine_ext as $k=>$v){
+            $mine_id_list[$k] = $v->mine_id;
+        }
+        //清除天地伟业的区域
+        if(count($mine_id_list) > 0){
+            foreach($index_code_list as $k=>$v){
+                if(in_array(explode('|',$v->degree)[0],$mine_id_list)){
+                    unset($index_code_list[$k]);
+                }
+            }
+        }
+
         foreach ($index_code_list as $key => $val) {
             $degree       = explode('|', $val->degree);
 //            $trans_result = CameraServices::getHaiKangTransList($degree[0]);
@@ -155,7 +181,8 @@ class UpdateHkList extends Command
             ->where('mine_list_ext.ip','!=','')
             ->where('mine_list_ext.port','!=','')
             ->where('mine_list_ext.key','!=','')
-            ->where('mine_list_ext.secret','!=','')->get();
+            ->where('mine_list_ext.secret','!=','')
+            ->where('mine_list_ext.deleted_at',null)->get();
 
         if(sizeof($mine_list_ext)>0){
             for($i=0;$i<sizeof($mine_list_ext);$i++){//循环同步所有天地伟业矿区