Selaa lähdekoodia

摄像头同步时间统计

任敬轩 2 vuotta sitten
vanhempi
commit
f4c96e38f0

+ 37 - 0
Modules/Camera/Database/Migrations/2023_04_24_100107_create_timetotal_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTimetotalTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('timetotal', function (Blueprint $table) {
+            $table->bigIncrements('id')->comment('ID');
+            $table->integer('mine_id')->index()->comment('区域ID');
+            $table->string('interface_start_time')->nullable()->comment('接口开始时间');
+            $table->string('interface_end_time')->nullable()->comment('接口结束时间');
+            $table->string('handle_start_time')->nullable()->comment('处理开始时间');
+            $table->string('handle_end_time')->nullable()->comment('处理结束时间');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('timetotal');
+    }
+}

+ 1 - 1
Modules/Camera/Services/CameraServices.php

@@ -1540,7 +1540,7 @@ class CameraServices
                 $list[$key]['camera_name'] = $val['cameraName'];
                 $list[$key]['trans_code']  = $val['encodeDevIndexCode'];
                 $list[$key]['com_number']  = $val['channelNo'];
-                $list[$key]['camera_status'] = $haikang->getCameraStatus($val['cameraIndexCode']);
+//                $list[$key]['camera_status'] = $haikang->getCameraStatus($val['cameraIndexCode']);
             }
         }
 

+ 13 - 7
app/Console/Commands/UpdateHkList.php

@@ -124,12 +124,12 @@ class UpdateHkList extends Command
         $index_code_list = MineList::where('index_code', '!=', null)->get();
 
         //去掉洗选
-//        foreach($index_code_list as $k=>$v){
-//            $degree = explode('|',$v->degree);
-//            if($degree[0] == 66){
-//                unset($index_code_list[$k]);
-//            }
-//        }
+        foreach($index_code_list as $k=>$v){
+            $degree = explode('|',$v->degree);
+            if($degree[0] == 5){
+                unset($index_code_list[$k]);
+            }
+        }
 
         //天地伟业矿区
         $mine_ext = DB::table('mine_list_ext')
@@ -166,6 +166,8 @@ class UpdateHkList extends Command
 
             //宁煤同步摄像头开始时间
             $nm_start_time = time();
+            $timetotal['mine_id'] = $val->id;
+            $timetotal['interface_start_time'] = date('Y-m-d H:i:s');
 
             $degree       = explode('|', $val->degree);
 //            $trans_result = CameraServices::getHaiKangTransList($degree[0]);
@@ -173,6 +175,8 @@ class UpdateHkList extends Command
 
             $info = DB::table('syn')->select('interface','handle')->orderBy('id','desc')->first();
             $syn2['interface'] = $info->interface . $val->id . ':' . (time() - $nm_start_time) . ';';
+            $timetotal['interface_end_time'] = date('Y-m-d H:i:s');
+            $timetotal['handle_start_time'] = date('Y-m-d H:i:s');
 //            DB::table('syn')->where('id',$syn_id)->update($syn2);
 
             $handle_start = time();
@@ -208,7 +212,7 @@ class UpdateHkList extends Command
                         'port'          => $port,
                         'com_number'    => $com_number,
                         //'sort'          => $arr_count - $k,
-                        'camera_status'        => $v['camera_status'],
+//                        'camera_status'        => $v['camera_status'],
                     ];
                     CameraList::updateOrCreate(['index_code' => $v['camera_id']], $params);
                 }
@@ -218,7 +222,9 @@ class UpdateHkList extends Command
             }
 
             $syn2['handle'] = $info->handle . $val->id . ':' . (time() - $handle_start) . ';';
+            $timetotal['handle_end_time'] = date('Y-m-d H:i:s');
             DB::table('syn')->where('id',$syn_id)->update($syn2);
+            DB::table('timetotal')->insert($timetotal);
 
             if($val->parent_id == 968){
                 //宁煤同步摄像头时间