Browse Source

占用车位灯光同一颜色

master
wanghongjun 2 weeks ago
parent
commit
cf65aa2111
  1. 38
      app/Services/ParkingSpaceService.php

38
app/Services/ParkingSpaceService.php

@ -350,7 +350,7 @@ class ParkingSpaceService extends BaseService
$update['recognition'] = '90'; $update['recognition'] = '90';
} }
$update['status'] = 1; $update['status'] = 1;
$this->changeStatusCameraColor( $this->changeSpaceCameraColor(
$oldValues['id'], $oldValues['id'],
$oldValues['space_type_id'], $oldValues['space_type_id'],
$oldValues['space_attr_id'], $oldValues['space_attr_id'],
@ -361,7 +361,7 @@ class ParkingSpaceService extends BaseService
$update['berthing_time'] = null; $update['berthing_time'] = null;
$update['recognition'] = ''; $update['recognition'] = '';
$update['status'] = 1; $update['status'] = 1;
$this->changeStatusCameraColor( $this->changeSpaceCameraColor(
$oldValues['id'], $oldValues['id'],
$oldValues['space_type_id'], $oldValues['space_type_id'],
$oldValues['space_attr_id'], $oldValues['space_attr_id'],
@ -371,7 +371,7 @@ class ParkingSpaceService extends BaseService
$update['license_plate_id'] = 0; $update['license_plate_id'] = 0;
$update['berthing_time'] = null; $update['berthing_time'] = null;
$update['recognition'] = ''; $update['recognition'] = '';
$this->changeStatusCameraColor( $this->changeSpaceCameraColor(
$oldValues['id'], $oldValues['id'],
$oldValues['space_type_id'], $oldValues['space_type_id'],
$oldValues['space_attr_id'], $oldValues['space_attr_id'],
@ -469,12 +469,12 @@ class ParkingSpaceService extends BaseService
); );
// 切换车位类型,同步切换车位灯颜色 // 切换车位类型,同步切换车位灯颜色
if ($oldValues['status'] != 2) { if ($oldValues['status'] != 2) {
$this->changeSpaceCameraColor($id, $type_id, $oldValues['space_attr_id']); $this->changeSpaceCameraColor($id, $type_id, $oldValues['space_attr_id'], $oldValues['status']);
} }
} }
// 切换模式更改车位类型 后 更改车位灯颜色 // 切换模式更改车位类型 后 更改车位灯颜色
public function changeSpaceCameraColor($space_id, $space_type_id, $space_attr, $is_repair = false) public function changeSpaceCameraColor($space_id, $space_type_id, $space_attr, $status)
{ {
$SpaceType = ParkingSpaceType::query()->find($space_type_id); $SpaceType = ParkingSpaceType::query()->find($space_type_id);
$SpaceTypeAttr = ParkingSpaceTypeAttr::getSpaceTypeAttrInfo($space_type_id, $space_attr); $SpaceTypeAttr = ParkingSpaceTypeAttr::getSpaceTypeAttrInfo($space_type_id, $space_attr);
@ -488,35 +488,15 @@ class ParkingSpaceService extends BaseService
$is_flicker = $SpaceTypeAttr['is_warning']; $is_flicker = $SpaceTypeAttr['is_warning'];
} }
// 维修灯 // 维修灯
if ($is_repair) { if ($status == 2) {
$repair_light_color = AdminConfigs::getRepairColor(); $repair_light_color = AdminConfigs::getRepairColor();
$color_occupy = $repair_light_color ?? 'clear'; $color_occupy = $repair_light_color ?? 'clear';
$color_vacant = $repair_light_color ?? 'clear'; $color_vacant = $repair_light_color ?? 'clear';
$is_flicker = false; $is_flicker = false;
} } elseif ($status == 1) {
$camera_ip = ParkingSpaceCamera::getCameraIp($space_id);
if ($camera_ip) {
HikParkingCameraService::setBody($camera_ip, $color_occupy, $color_vacant, $is_flicker);
}
}
// 手动修改油车更改车位灯颜色
public function changeStatusCameraColor($space_id, $space_type_id, $space_attr, $status)
{
$SpaceType = ParkingSpaceType::query()->find($space_type_id);
$SpaceTypeAttr = ParkingSpaceTypeAttr::getSpaceTypeAttrInfo($space_type_id, $space_attr);
$color_occupy = $SpaceType['default_color_occupy'];
$color_vacant = $SpaceType['default_color_vacant'];
$is_flicker = $SpaceType['default_is_warning'];
if ($SpaceTypeAttr) {
$color_occupy = $SpaceTypeAttr['color_occupy'];
$color_vacant = $SpaceTypeAttr['color_vacant'];
$is_flicker = $SpaceTypeAttr['is_warning'];
}
if ($status == 1) {
$color_vacant = $color_occupy; $color_vacant = $color_occupy;
} }
$camera_ip = ParkingSpaceCamera::getCameraIp($space_id); $camera_ip = ParkingSpaceCamera::getCameraIp($space_id);
if ($camera_ip) { if ($camera_ip) {
HikParkingCameraService::setBody($camera_ip, $color_occupy, $color_vacant, $is_flicker); HikParkingCameraService::setBody($camera_ip, $color_occupy, $color_vacant, $is_flicker);
@ -674,7 +654,7 @@ class ParkingSpaceService extends BaseService
$id, $id,
$space_type_id, $space_type_id,
$space_attr_id, $space_attr_id,
$status == 2 $status
); );
} }

Loading…
Cancel
Save