正在显示
1 个修改的文件
包含
7 行增加
和
0 行删除
| @@ -9,6 +9,7 @@ use App\Utils\EncryptUtils; | @@ -9,6 +9,7 @@ use App\Utils\EncryptUtils; | ||
| 9 | use App\Utils\LogUtils; | 9 | use App\Utils\LogUtils; |
| 10 | use Illuminate\Database\Eloquent\ModelNotFoundException; | 10 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
| 11 | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | 11 | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
| 12 | +use Illuminate\Support\Arr; | ||
| 12 | use Illuminate\Support\Facades\Route; | 13 | use Illuminate\Support\Facades\Route; |
| 13 | use Illuminate\Validation\ValidationException; | 14 | use Illuminate\Validation\ValidationException; |
| 14 | use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; | 15 | use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; |
| @@ -127,6 +128,12 @@ class Handler extends ExceptionHandler | @@ -127,6 +128,12 @@ class Handler extends ExceptionHandler | ||
| 127 | //开启debug 错误原样输出 | 128 | //开启debug 错误原样输出 |
| 128 | $debub = config('app.debug'); | 129 | $debub = config('app.debug'); |
| 129 | $message = $debub ? $message : ($code->description ?? $message); | 130 | $message = $debub ? $message : ($code->description ?? $message); |
| 131 | + | ||
| 132 | + //请求参数错误 输出具体错误信息 | ||
| 133 | + if($code == Code::USER_PARAMS_ERROE()){ | ||
| 134 | + $message = Arr::first(Arr::first($exception->errors())); | ||
| 135 | + } | ||
| 136 | + | ||
| 130 | $response = [ | 137 | $response = [ |
| 131 | 'code' => $code, | 138 | 'code' => $code, |
| 132 | 'message' => $message | 139 | 'message' => $message |
-
请 注册 或 登录 后发表评论