|
|
@ -292,13 +292,7 @@ class ParkingSpaceRepairController extends BaseController |
|
|
} |
|
|
} |
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
|
|
|
|
|
|
$start_at_times = strtotime($data['start_at']); |
|
|
$this->validateDate($data['start_at'], $data['end_at']); |
|
|
$end_at_times = strtotime($data['end_at']); |
|
|
|
|
|
if ($start_at_times >= $end_at_times) { |
|
|
|
|
|
throw new CustomException( |
|
|
|
|
|
__validation('parking_repair_list.date_error') |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($validator->fails()) { |
|
|
if ($validator->fails()) { |
|
|
throw new ValidationException($validator); |
|
|
throw new ValidationException($validator); |
|
|
@ -462,13 +456,54 @@ class ParkingSpaceRepairController extends BaseController |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
* 维修开始时间不能大于结束时间 |
|
|
|
|
|
* @param $start_at |
|
|
|
|
|
* @param $end_at |
|
|
|
|
|
* @return void |
|
|
|
|
|
* @throws CustomException |
|
|
|
|
|
*/ |
|
|
|
|
|
protected function validateDate($start_at, $end_at): void |
|
|
|
|
|
{ |
|
|
|
|
|
$start_at_times = strtotime($start_at); |
|
|
|
|
|
$end_at_times = strtotime($end_at); |
|
|
|
|
|
if ($start_at_times >= $end_at_times) { |
|
|
|
|
|
throw new CustomException( |
|
|
|
|
|
__validation('parking_repair_list.date_error') |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param Request $request |
|
|
* @return JsonResponse |
|
|
* @return JsonResponse |
|
|
* @throws CustomException |
|
|
* @throws CustomException |
|
|
* @throws ValidationException |
|
|
* @throws ValidationException |
|
|
*/ |
|
|
*/ |
|
|
public function synchronizeList(): JsonResponse |
|
|
public function synchronizeList(Request $request): JsonResponse |
|
|
{ |
|
|
{ |
|
|
try { |
|
|
try { |
|
|
|
|
|
$data = $request->all(); |
|
|
|
|
|
$rules = [ |
|
|
|
|
|
'start_at' => 'required', |
|
|
|
|
|
'end_at' => 'required' |
|
|
|
|
|
]; |
|
|
|
|
|
$messages = [ |
|
|
|
|
|
'start_at.required' => __validation( |
|
|
|
|
|
'parking_repair_list.s_empty' |
|
|
|
|
|
), |
|
|
|
|
|
'end_at.required' => __validation( |
|
|
|
|
|
'parking_repair_list.e_empty' |
|
|
|
|
|
) |
|
|
|
|
|
]; |
|
|
|
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
|
|
|
|
|
|
|
|
|
if ($validator->fails()) { |
|
|
|
|
|
throw new ValidationException($validator); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->validateDate($data['start_at'], $data['end_at']); |
|
|
|
|
|
|
|
|
|
|
|
$this->service->synchronize($data); |
|
|
return $this->responseService->success( |
|
|
return $this->responseService->success( |
|
|
null, |
|
|
null, |
|
|
__('admin.operation_successful') |
|
|
__('admin.operation_successful') |
|
|
|