Commit f957b20f f957b20fe5ad6ab3b951b9b8c3ff5e35cc35db02 by lemon

*

1 parent eab6d6c0
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
2 2
3 namespace App\Exceptions; 3 namespace App\Exceptions;
4 4
5 use App\Helper\ErrorCode;
6 use App\Helper\Response;
5 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; 7 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8 use Illuminate\Validation\ValidationException;
6 use Throwable; 9 use Throwable;
7 10
8 class Handler extends ExceptionHandler 11 class Handler extends ExceptionHandler
...@@ -38,4 +41,6 @@ class Handler extends ExceptionHandler ...@@ -38,4 +41,6 @@ class Handler extends ExceptionHandler
38 // 41 //
39 }); 42 });
40 } 43 }
44
45
41 } 46 }
......
...@@ -30,9 +30,12 @@ class Response ...@@ -30,9 +30,12 @@ class Response
30 * @param int $code 30 * @param int $code
31 * @return mixed 31 * @return mixed
32 */ 32 */
33 public static function error($code = ErrorCode::SERVER_ERROR) 33 public static function error($code = ErrorCode::SERVER_ERROR, string $msg = '')
34 { 34 {
35 return response()->json(['code' => $code, 'msg' => ErrorCode::$messages[$code] ?? ErrorCode::$messages[ErrorCode::SERVER_ERROR]]); 35 return response()->json([
36 'code' => $code,
37 'msg' => $msg ?? (ErrorCode::$messages[$code] ?? ErrorCode::$messages[ErrorCode::SERVER_ERROR])
38 ]);
36 } 39 }
37 40
38 /** 41 /**
......
...@@ -35,8 +35,8 @@ class MusicianWithdrawRequest extends FormRequest ...@@ -35,8 +35,8 @@ class MusicianWithdrawRequest extends FormRequest
35 public function messages(): array 35 public function messages(): array
36 { 36 {
37 return [ 37 return [
38 'order_id.required' => '订单号不存在', 38 'order_id.required' => '缺少订单号',
39 'status.required' => '审核状态错误', 39 'status.required' => '缺少审核状态',
40 'status.in' => '审核状态错误', 40 'status.in' => '审核状态错误',
41 ]; 41 ];
42 } 42 }
......
...@@ -67,7 +67,7 @@ return [ ...@@ -67,7 +67,7 @@ return [
67 | 67 |
68 */ 68 */
69 69
70 'timezone' => 'UTC', 70 'timezone' => 'PRC',
71 71
72 /* 72 /*
73 |-------------------------------------------------------------------------- 73 |--------------------------------------------------------------------------
......