refactor: 使用 ApiMessage 统一错误响应格式
- 在多个控制器中引入 ApiMessage,替换原有的 ApiResponse 错误处理逻辑,确保错误信息的一致性与可读性。 - 更新错误返回信息,使用更具语义的键值,提升 API 的可维护性与用户体验。 - 适配相关控制器的请求参数,确保在处理错误时能够正确返回相应的错误信息。
This commit is contained in:
@@ -6,5 +6,25 @@ return [
|
||||
'invalid_credentials' => 'Invalid account or password.',
|
||||
'account_disabled' => 'This account has been disabled.',
|
||||
'permission_denied' => 'You do not have permission to perform this action.',
|
||||
'forbidden' => 'You do not have permission to perform this action.',
|
||||
'settlement_run_skipped' => 'Settlement was not run for this draw (check draw status and published result batch).',
|
||||
'site_access_denied' => 'You do not have access to this site.',
|
||||
'site_rotate_denied' => 'You cannot rotate secrets for this site.',
|
||||
'site_update_denied' => 'You cannot modify this site.',
|
||||
'site_player_access_denied' => 'You do not have access to players under this site.',
|
||||
'player_create_site_forbidden' => 'You cannot create players under this site.',
|
||||
'player_already_registered' => 'This main-site player is already registered.',
|
||||
'player_wallet_balance_blocks_delete' => 'Player wallet still has balance. Clear it before deletion.',
|
||||
'player_has_tickets_blocks_delete' => 'Player has ticket records and cannot be deleted.',
|
||||
'role_cannot_delete_super_admin' => 'Cannot delete the super admin role.',
|
||||
'role_builtin_cannot_delete' => 'Built-in roles cannot be deleted.',
|
||||
'role_has_users_cannot_delete' => 'This role still has assigned admins and cannot be deleted.',
|
||||
'user_cannot_delete_self' => 'Cannot delete your own account.',
|
||||
'user_cannot_delete_last_super_admin' => 'Cannot delete the last super admin.',
|
||||
'super_admin_only_for_roles' => 'Only super admins can manage roles.',
|
||||
'route_name_missing_for_permission' => 'Admin route is missing a route name for permission checks.',
|
||||
'api_resource_not_configured' => 'Admin API resource is not configured: :route',
|
||||
'api_resource_no_permission_binding' => 'Admin API resource has no permission binding: :code',
|
||||
'currency_default_cannot_delete' => 'Default currency cannot be deleted.',
|
||||
'currency_referenced_cannot_delete' => 'Currency is referenced by business data and cannot be deleted: :refs',
|
||||
];
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'success' => [
|
||||
'ok' => 'OK',
|
||||
],
|
||||
|
||||
'validation_failed' => 'The given data was invalid.',
|
||||
'client_error' => 'This request could not be completed.',
|
||||
'invalid_params' => 'Invalid request parameters.',
|
||||
'invalid_settings_group' => 'This settings group is not allowed.',
|
||||
'draw_no_exists' => 'Draw number already exists. Use another draw number or sequence.',
|
||||
'draw_not_found' => 'Draw not found.',
|
||||
'draw_timeline_invalid' => 'Start time must be before close time, and close time must be before draw time.',
|
||||
'draw_not_editable' => 'Only pending draws, or open draws with no bets, can be edited.',
|
||||
'draw_not_deletable' => 'Only pending draws with no bets can be deleted.',
|
||||
@@ -14,4 +21,37 @@ return [
|
||||
'too_many_requests' => 'Too many requests. Please try again later.',
|
||||
'server_error' => 'Something went wrong. Please try again later.',
|
||||
'jackpot_manual_burst_failed' => 'Manual jackpot burst failed: :reason',
|
||||
'config_version_not_draft' => 'This config version is not a draft.',
|
||||
'config_version_cannot_delete_active' => 'Cannot delete the active config version.',
|
||||
'effective_config_not_initialized' => 'Play configuration has not been initialized.',
|
||||
'invalid_or_disabled_currency' => 'Invalid or disabled currency.',
|
||||
'risk_pool_no_remaining_amount' => 'Insufficient remaining amount in the risk pool.',
|
||||
|
||||
'reasons' => [
|
||||
'jackpot_disabled' => 'Jackpot pool is disabled.',
|
||||
'jackpot_pool_empty' => 'Jackpot pool balance is zero.',
|
||||
'jackpot_already_burst_for_draw' => 'Jackpot was already burst for this draw.',
|
||||
'jackpot_manual_no_first_prize_winners' => 'No first-prize winners on this draw.',
|
||||
'jackpot_already_allocated_for_draw' => 'Jackpot was already allocated for this draw.',
|
||||
'draw_not_ready_for_jackpot_burst' => 'Draw is not in settling or settled status.',
|
||||
'draw_result_not_published' => 'Draw results have not been published.',
|
||||
'settlement_batch_not_found' => 'Settlement batch not found for this draw.',
|
||||
'settlement_not_pending_review' => 'Settlement batch is not pending review.',
|
||||
'settlement_not_approved' => 'Settlement batch is not approved.',
|
||||
'draw_has_unsettled_tickets' => 'This draw still has unsettled tickets.',
|
||||
'batch_not_pending_review' => 'Result batch is not pending review.',
|
||||
'draw_not_ready_to_publish' => 'Draw is not ready to publish results.',
|
||||
'batch_result_version_stale' => 'Result batch version is stale. Refresh and try again.',
|
||||
'draw_settlement_in_progress' => 'Settlement is in progress for this draw.',
|
||||
'draw_already_settled' => 'This draw is already settled.',
|
||||
'draw_pending_result_batch_exists' => 'A pending result batch already exists.',
|
||||
'draw_not_closeable' => 'This draw cannot be closed manually.',
|
||||
'draw_not_cancelable' => 'This draw cannot be cancelled.',
|
||||
'draw_has_settled_tickets' => 'This draw has settled tickets.',
|
||||
'draw_not_runnable' => 'RNG cannot be run for this draw.',
|
||||
'draw_not_in_cooldown' => 'Draw is not in cooldown.',
|
||||
'adjustment_delta_zero' => 'Adjustment amount cannot be zero.',
|
||||
'adjustment_reason_required' => 'Adjustment reason is required.',
|
||||
'adjustment_would_make_balance_negative' => 'Adjustment would make pool balance negative.',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
/** PRD 钱包段多语言;NegotiateLotteryLocale 后由 __() 选用 */
|
||||
return [
|
||||
'invalid_currency' => 'Invalid currency code',
|
||||
'order_not_found' => 'Transfer order not found',
|
||||
|
||||
'1001' => 'Insufficient lottery wallet balance',
|
||||
'1002' => 'A previous transfer is still processing; please retry shortly',
|
||||
|
||||
Reference in New Issue
Block a user