refactor: 重构语言协商中间件,简化语言解析逻辑并增强异常处理,更新相关配置以支持多环境开发
This commit is contained in:
25
app/Lottery/ErrorCode.php
Normal file
25
app/Lottery/ErrorCode.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Lottery;
|
||||
|
||||
/**
|
||||
* HTTP JSON 中与 `ApiResponse` 对齐的业务码常量(对齐 docs/04 §10)。
|
||||
* SSO 等特殊场景仍由各模块直接写整数(如 EnsurePlayerApi 使用的 8001)。
|
||||
*/
|
||||
enum ErrorCode: int
|
||||
{
|
||||
/** 表单 / Query 校验失败(见 ValidationException → 422) */
|
||||
case ValidationFailed = 9001;
|
||||
|
||||
/** 资源或路由不存在 */
|
||||
case NotFound = 9004;
|
||||
|
||||
/** 请求过于频繁 */
|
||||
case TooManyRequests = 9031;
|
||||
|
||||
/** `abort(4xx)` 等客户端类 Http 异常(HTTP 状态码见响应头;本码作业务归类) */
|
||||
case ClientHttpError = 9010;
|
||||
|
||||
/** 未分类服务端异常(生产环境不向客户端暴露细节) */
|
||||
case InternalError = 9999;
|
||||
}
|
||||
Reference in New Issue
Block a user