diff --git a/app/Console/Commands/VehicleEntryAndExit.php b/app/Console/Commands/VehicleEntryAndExit.php index 23ee6d4..5e0a3dc 100644 --- a/app/Console/Commands/VehicleEntryAndExit.php +++ b/app/Console/Commands/VehicleEntryAndExit.php @@ -36,11 +36,14 @@ class VehicleEntryAndExit extends Command $ip = $item['camera_ip']; $ParkingNo = ''; $imageData = ''; + $confidenceLevel = ''; + $date_time = date('Y-m-d H:i:s', time()); try { $MNPRData = CameraDeviceService::query($ip)->getTrafficMNPR(); if ($MNPRData['licensePlate']) { $ParkingNo = $MNPRData['licensePlate']; $imageData = $MNPRData['images_data']; + $confidenceLevel = $MNPRData['confidenceLevel']; } } catch (\Exception $e) { continue; @@ -50,8 +53,10 @@ class VehicleEntryAndExit extends Command 'number' => $item['number'], 'license_plate_number' => $ParkingNo, 'image_data' => base64_encode($imageData), - 'date_time' => date('Y-m-d H:i:s', time()), + 'confidenceLevel' => $confidenceLevel, + 'date_time' => $date_time, ]; + dd($data); } // 返回告诉设备状态情况 CameraApiService::query()->putCameraPlateNoBody(['list' => $data]); diff --git a/app/Services/Device/CameraDeviceService.php b/app/Services/Device/CameraDeviceService.php index 1d99bd3..bb625fa 100644 --- a/app/Services/Device/CameraDeviceService.php +++ b/app/Services/Device/CameraDeviceService.php @@ -111,8 +111,10 @@ class CameraDeviceService extends BaseService // 抓拍车位车牌及现场图片 #[ArrayShape([ - 'licensePlate' => "mixed|string", - 'images_data' => "mixed|string" + 'licensePlate' => "mixed|string", // 车牌号码 + 'images_data' => "mixed|string", // 场景图 + 'confidenceLevel' => "mixed|string", // 识别度 + 'dateTime' => "mixed|string" // ])] public function getTrafficMNPR(int $channels_id = 1): array { $url = $this->getUrl($this->TRAFFIC_MNPR . $channels_id); @@ -120,8 +122,10 @@ class CameraDeviceService extends BaseService $body = $response->body(); $parsed = CommonService::parseMultipart($body); $data = [ - 'licensePlate' => '', - 'images_data' => '' + 'licensePlate' => '', + 'images_data' => '', + 'confidenceLevel' => '', + 'dateTime' => '' ]; if ($parsed['xml'] && is_array($parsed['xml'])) { if (isset($parsed['xml']['ANPR']['licensePlate'])) { @@ -129,6 +133,10 @@ class CameraDeviceService extends BaseService if ($licensePlate != '无车牌') { $data['licensePlate'] = $licensePlate; } + $data['confidenceLevel'] = $parsed['xml']['ANPR']['confidenceLevel']; + } + if (isset($parsed['xml']['dateTime'])) { + $data['dateTime'] = $parsed['xml']['dateTime']; } } if ($data['licensePlate'] && $parsed['images'] && is_array($parsed['images'])) {