|
|
|
@ -24,27 +24,6 @@ class CameraApiController extends BaseController |
|
|
|
} |
|
|
|
|
|
|
|
public function getCameraData(): JsonResponse |
|
|
|
{ |
|
|
|
$data = ParkingCamera::query()->select(['id', 'camera_ip', 'status']) |
|
|
|
->get() |
|
|
|
->toArray(); |
|
|
|
return $this->responseService->success(['list' => $data]); |
|
|
|
} |
|
|
|
|
|
|
|
public function updateCameraStatus(Request $request): JsonResponse |
|
|
|
{ |
|
|
|
$data = $request->all(); |
|
|
|
$list = $data['list']; |
|
|
|
foreach ($list as $item) { |
|
|
|
$id = $item['id'] ?? 0; |
|
|
|
$camera_ip = $item['camera_ip'] ?? ''; |
|
|
|
$status = $item['status'] ?? 0; |
|
|
|
$this->service->updateStatus($id, $camera_ip, $status); |
|
|
|
} |
|
|
|
return $this->responseService->success([], 'SUCCESS'); |
|
|
|
} |
|
|
|
|
|
|
|
public function getCameraBody(): JsonResponse |
|
|
|
{ |
|
|
|
$body = [ |
|
|
|
"lampType" => "internal", |
|
|
|
@ -56,12 +35,12 @@ class CameraApiController extends BaseController |
|
|
|
"VehicleNoExist" => [ |
|
|
|
"enabled" => true, |
|
|
|
"flashEnabled" => false, |
|
|
|
"lampColor" => 'green' |
|
|
|
"lampColor" => 'red' |
|
|
|
], |
|
|
|
"VehicleExist" => [ |
|
|
|
"enabled" => true, |
|
|
|
"flashEnabled" => false, |
|
|
|
"lampColor" => 'green' |
|
|
|
"lampColor" => 'red' |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
@ -96,11 +75,34 @@ class CameraApiController extends BaseController |
|
|
|
] |
|
|
|
] |
|
|
|
]; |
|
|
|
Cache::put('camera_body', json_encode($body), 300); |
|
|
|
$data = ParkingCamera::query()->select(['id', 'camera_ip', 'status']) |
|
|
|
->get() |
|
|
|
->toArray(); |
|
|
|
return $this->responseService->success(['list' => $data]); |
|
|
|
} |
|
|
|
|
|
|
|
public function updateCameraStatus(Request $request): JsonResponse |
|
|
|
{ |
|
|
|
$data = $request->all(); |
|
|
|
$list = $data['list']; |
|
|
|
foreach ($list as $item) { |
|
|
|
$id = $item['id'] ?? 0; |
|
|
|
$camera_ip = $item['camera_ip'] ?? ''; |
|
|
|
$status = $item['status'] ?? 0; |
|
|
|
$this->service->updateStatus($id, $camera_ip, $status); |
|
|
|
} |
|
|
|
return $this->responseService->success([], 'SUCCESS'); |
|
|
|
} |
|
|
|
|
|
|
|
public function getCameraBody(): JsonResponse |
|
|
|
{ |
|
|
|
$body = Cache::get('camera_body'); |
|
|
|
if (!$body) { |
|
|
|
return $this->responseService->error('empty'); |
|
|
|
} else { |
|
|
|
// $bodyArr = json_decode($body); |
|
|
|
// Cache::delete('camera_body'); |
|
|
|
$bodyArr = json_decode($body); |
|
|
|
Cache::delete('camera_body'); |
|
|
|
} |
|
|
|
return $this->responseService->success($body, 'SUCCESS'); |
|
|
|
} |
|
|
|
|