Browse Source

摄像头同步接口

任敬轩 2 days ago
parent
commit
af51b5856e
1 changed files with 36 additions and 0 deletions
  1. 36 0
      app/Console/Commands/UpdateHkList.php

+ 36 - 0
app/Console/Commands/UpdateHkList.php

@@ -53,9 +53,45 @@ class UpdateHkList extends Command
         $this->updateAreaList();
 //        echo '区域结束:'.date('Y-m-d H:i:s');
         $this->updateCameraList();
+
+        $this->insert_camera_id();
         echo '时长:'.number_format(((time()-$start_time)/60),2).'分钟';
     }
 
+    //金家渠摄像头ID姓名同步
+    public function insert_camera_id(){
+        DB::connection('mysql_fwe10')->table('uf_sxtmcdyi')->where('mkid','2345')->delete();
+
+        $camera_list = DB::table('camera_list as c')
+            ->select('c.id', 'c.camera_name')
+            ->join('mine_list as m', 'c.mine_id', '=', 'm.id')
+            ->where('m.degree', 'like', '968|2345%')
+            ->where('m.deleted_at', null)
+            ->where('c.deleted_at', null)
+            ->get()
+            ->toArray();
+
+        foreach($camera_list as $k=>$v){
+            $id = mt_rand(pow(10, 18), pow(10, 18) + 999999999);
+            $insert = [
+                'ID' => $id,
+                'FORM_DATA_ID' => $id,
+                'DATA_INDEX' => 0.0,
+                'CREATE_TIME' => date('Y-m-d H:i:s'),
+                'TENANT_KEY' => 't1zz9w8165',
+                'IS_DELETE' => 0,
+                'DELETE_TYPE' => 0,
+                'FT_STATUS' => 0,
+
+                'ssmk' => '金家渠煤矿',
+                'mkid' => '2345',
+                'sxtmc' => $v->camera_name,
+                'sxtid' => $v->id
+            ];
+            DB::connection('mysql_fwe10')->table('uf_sxtmcdyi')->insert($insert);
+        }
+    }
+
     //同步区域列表
     public function updateAreaList()
     {