|
|
|
@ -3,7 +3,10 @@ |
|
|
|
namespace App\Services; |
|
|
|
|
|
|
|
use App\Exceptions\CustomException; |
|
|
|
use App\Models\ParkingCamera; |
|
|
|
use App\Models\ParkingLicensePlate; |
|
|
|
use App\Models\ParkingSpace; |
|
|
|
use App\Models\ParkingSpaceCamera; |
|
|
|
use App\Models\ParkingVipAccessRecord; |
|
|
|
use App\Models\ParkingVipList; |
|
|
|
use Exception; |
|
|
|
@ -140,7 +143,8 @@ class ParkingVipListService |
|
|
|
$space_type_id, |
|
|
|
$access_record_id, |
|
|
|
$enter_time, |
|
|
|
$license_id |
|
|
|
$license_id, |
|
|
|
$floor_id |
|
|
|
) { |
|
|
|
$vip_list_id = ParkingVipList::query()->where('license_id', $license_id) |
|
|
|
->value('id'); |
|
|
|
@ -156,7 +160,10 @@ class ParkingVipListService |
|
|
|
'enter_time' => $enter_time, |
|
|
|
'access_record_id' => $access_record_id, |
|
|
|
]); |
|
|
|
self::notice($space_id, $floor_id, 'addDeviceVipNotice'); |
|
|
|
} |
|
|
|
// 判断是否违停 |
|
|
|
self::isIllegal($license_id, $space_type_id, $space_id, $floor_id); |
|
|
|
} |
|
|
|
|
|
|
|
// vip 车辆离场 |
|
|
|
@ -171,4 +178,44 @@ class ParkingVipListService |
|
|
|
$id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 判断是否违停 |
|
|
|
protected static function isIllegal( |
|
|
|
$license_id, |
|
|
|
$space_type_id, |
|
|
|
$space_id, |
|
|
|
$floor_id |
|
|
|
): void { |
|
|
|
if ($space_type_id && $license_id) { |
|
|
|
$exists = ParkingLicensePlate::query()->where([ |
|
|
|
'id' => $license_id, |
|
|
|
'space_type_id' => $space_type_id |
|
|
|
])->exists(); |
|
|
|
if ($exists) { |
|
|
|
return; |
|
|
|
} |
|
|
|
self::notice($space_id, $floor_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 违泊、VIP 进入提醒 |
|
|
|
protected static function notice( |
|
|
|
$space_id, |
|
|
|
$floor_id, |
|
|
|
$str = 'addDeviceIllegalNotice' |
|
|
|
): void { |
|
|
|
$camera_id = ParkingSpaceCamera::query()->where( |
|
|
|
'space_id', |
|
|
|
$space_id |
|
|
|
)->value('camera_id'); |
|
|
|
$camera_ip = ParkingCamera::query()->where('id', $camera_id) |
|
|
|
->value('camera_ip'); |
|
|
|
AdminNoticeService::$str( |
|
|
|
$camera_id ?? 0, |
|
|
|
$camera_ip ?? '', |
|
|
|
$space_id, |
|
|
|
$floor_id, |
|
|
|
1 |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|