|
|
|
@ -244,4 +244,54 @@ class ParkingSpaceController extends Controller |
|
|
|
__('exports.parking_space.list') . time() . '.xlsx' |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function information(Request $request): JsonResponse |
|
|
|
{ |
|
|
|
try { |
|
|
|
$data = []; |
|
|
|
|
|
|
|
$parking_space_id = $request->post('parking_space_id', ''); |
|
|
|
|
|
|
|
$item = ParkingSpace::query()->where('id', $parking_space_id) |
|
|
|
->first(); |
|
|
|
if (empty($item)) { |
|
|
|
throw new Exception(__('controller.parking_space.not_space')); |
|
|
|
} |
|
|
|
|
|
|
|
$statusArr = $this->service->getStatusArr(); |
|
|
|
|
|
|
|
$data['parking_space_number'] = $item['number']; |
|
|
|
$data['license_plate'] = ParkingLicensePlate::getNumber($item['license_plate_id']); |
|
|
|
$data['status'] = $statusArr[$item['status']]; |
|
|
|
$data['parking_space_type'] = ParkingSpaceType::getName($item['space_type_id']); |
|
|
|
$data['berthing_time_str'] = ''; |
|
|
|
if ($item['berthing_time']) { |
|
|
|
$difference = get_time_difference($item['berthing_time']); |
|
|
|
if (!isset($difference['error'])) { |
|
|
|
if (!empty($difference['days'])) { |
|
|
|
$data['berthing_time_str'] .= $difference['days'] . __('controller.parking_space.days'); |
|
|
|
} |
|
|
|
if (!empty($difference['hours']) || !empty($data['berthing_time_str'])) { |
|
|
|
$data['berthing_time_str'] .= $difference['hours'] . __('controller.parking_space.hours'); |
|
|
|
} |
|
|
|
if (!empty($difference['minutes']) || !empty($data['berthing_time_str'])) { |
|
|
|
$data['berthing_time_str'] .= $difference['minutes'] . __('controller.parking_space.minutes'); |
|
|
|
} |
|
|
|
if (!empty($difference['seconds']) || !empty($data['berthing_time_str'])) { |
|
|
|
$data['berthing_time_str'] .= $difference['seconds'] . __('controller.parking_space.seconds'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$data['recognition'] = $this->service->getRecognition( |
|
|
|
$item['recognition'] |
|
|
|
); |
|
|
|
$data['space_url'] = ''; |
|
|
|
return $this->responseService->success($data); |
|
|
|
} catch (Exception $e) { |
|
|
|
$m_prefix = __('exception.exception_handler.resource'); |
|
|
|
return $this->responseService->systemError( |
|
|
|
$m_prefix . ':' . $e->getMessage() |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|