Browse Source

优化业务错误返回

master
wanghongjun 4 days ago
parent
commit
fb0c76606c
  1. 4
      app/Http/Controllers/Admin/ConfigController.php
  2. 4
      app/Http/Controllers/Admin/EventCalendarController.php
  3. 8
      app/Http/Controllers/Admin/ParkingAttendantController.php
  4. 8
      app/Http/Controllers/Admin/ParkingCameraController.php
  5. 4
      app/Http/Controllers/Admin/ParkingElectronicMapController.php
  6. 4
      app/Http/Controllers/Admin/ParkingGateControlController.php
  7. 4
      app/Http/Controllers/Admin/ParkingInformationController.php
  8. 6
      app/Http/Controllers/Admin/ParkingLicensePlateController.php
  9. 12
      app/Http/Controllers/Admin/ParkingPatternController.php
  10. 16
      app/Http/Controllers/Admin/ParkingSpaceController.php
  11. 16
      app/Http/Controllers/Admin/ParkingSpaceRepairController.php
  12. 4
      app/Http/Controllers/Admin/ParkingWhitelistController.php
  13. 12
      app/Http/Controllers/Admin/UserController.php
  14. 8
      app/Http/Controllers/Admin/VipListController.php

4
app/Http/Controllers/Admin/ConfigController.php

@ -131,8 +131,10 @@ class ConfigController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.update_admin_config_failed') . ':'

4
app/Http/Controllers/Admin/EventCalendarController.php

@ -324,8 +324,10 @@ class EventCalendarController extends BaseController
null,
__('exception.event_calendar.end_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.event_calendar.end_failed')

8
app/Http/Controllers/Admin/ParkingAttendantController.php

@ -124,8 +124,10 @@ class ParkingAttendantController extends BaseController
null,
__('admin.save_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('admin.operation_failed') . ':'
@ -214,8 +216,10 @@ class ParkingAttendantController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('admin.operation_failed') . ':'

8
app/Http/Controllers/Admin/ParkingCameraController.php

@ -213,8 +213,10 @@ class ParkingCameraController extends BaseController
null,
__('admin.save_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.parking_camera.create_failed') . ':'
@ -304,8 +306,10 @@ class ParkingCameraController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.parking_camera.update_failed') . ':'

4
app/Http/Controllers/Admin/ParkingElectronicMapController.php

@ -146,8 +146,10 @@ class ParkingElectronicMapController extends BaseController
$this->service->saveModel($saveData);
return $this->responseService->success([],
__('admin.save_succeeded'));
} catch (CustomException|ValidationException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
$m_prefix = __('admin.save_failed');
return $this->responseService->systemError(

4
app/Http/Controllers/Admin/ParkingGateControlController.php

@ -213,7 +213,7 @@ class ParkingGateControlController extends BaseController
)
);
} catch (CustomException $e) {
throw $e;
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.get_data_failed') . ':' . $e->getMessage()
@ -231,7 +231,7 @@ class ParkingGateControlController extends BaseController
]
);
} catch (CustomException $e) {
throw $e;
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.get_data_failed') . ':' . $e->getMessage()

4
app/Http/Controllers/Admin/ParkingInformationController.php

@ -220,8 +220,10 @@ class ParkingInformationController extends BaseController
null,
__('admin.delete_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.license_plate.destroy_failed') . ':'

6
app/Http/Controllers/Admin/ParkingLicensePlateController.php

@ -291,8 +291,10 @@ class ParkingLicensePlateController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'
@ -329,7 +331,7 @@ class ParkingLicensePlateController extends BaseController
];
return $this->responseService->success($data);
} catch (CustomException $e) {
throw $e;
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('controller.license_plate.not_put')

12
app/Http/Controllers/Admin/ParkingPatternController.php

@ -302,8 +302,10 @@ class ParkingPatternController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'
@ -375,8 +377,10 @@ class ParkingPatternController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'
@ -399,8 +403,10 @@ class ParkingPatternController extends BaseController
null,
__('admin.delete_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.parking_pattern.destroy_failed') . ':'

16
app/Http/Controllers/Admin/ParkingSpaceController.php

@ -207,9 +207,11 @@ class ParkingSpaceController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (Exception $e) {
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.parking_space.update_type_failed') . ':'
. $e->getMessage()
@ -248,9 +250,11 @@ class ParkingSpaceController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (Exception $e) {
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.parking_space.update_attr_failed') . ':'
. $e->getMessage()
@ -674,8 +678,10 @@ class ParkingSpaceController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'

16
app/Http/Controllers/Admin/ParkingSpaceRepairController.php

@ -258,8 +258,10 @@ class ParkingSpaceRepairController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('admin.operation_failed') . ':'
@ -414,8 +416,10 @@ class ParkingSpaceRepairController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'
@ -441,8 +445,10 @@ class ParkingSpaceRepairController extends BaseController
null,
__('admin.save_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('admin.operation_failed') . ':'
@ -514,8 +520,10 @@ class ParkingSpaceRepairController extends BaseController
null,
__('admin.operation_successful')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('admin.operation_failed') . ':'

4
app/Http/Controllers/Admin/ParkingWhitelistController.php

@ -290,8 +290,10 @@ class ParkingWhitelistController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'

12
app/Http/Controllers/Admin/UserController.php

@ -115,8 +115,10 @@ class UserController extends BaseController
null,
__('admin.save_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_user.create_failed') . ':' . $e->getMessage(
@ -230,8 +232,10 @@ class UserController extends BaseController
null,
__('admin.update_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_user.update_failed') . ':' . $e->getMessage(
@ -254,8 +258,10 @@ class UserController extends BaseController
null,
__('admin.delete_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_user.destroy_failed') . ':'

8
app/Http/Controllers/Admin/VipListController.php

@ -213,8 +213,10 @@ class VipListController extends BaseController
return $this->responseService->success(
__('controller.import.success')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.import_failed') . ':'
@ -239,8 +241,10 @@ class VipListController extends BaseController
null,
__('admin.save_succeeded')
);
} catch (ValidationException|CustomException $e) {
} catch (ValidationException $e) {
throw $e;
} catch (CustomException $e) {
return $this->responseService->businessError($e->getMessage());
} catch (Exception $e) {
return $this->responseService->systemError(
__('exception.admin_vip_list.create_failed') . ':'

Loading…
Cancel
Save