mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
refactor: 规范状态码、抛出异常的使用
This commit is contained in:
@@ -19,10 +19,10 @@ class User
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$authorization = $request->input('auth_data') ?? $request->header('authorization');
|
||||
if (!$authorization) throw new ApiException(403, '未登录或登陆已过期');
|
||||
if (!$authorization) throw new ApiException( '未登录或登陆已过期', 403);
|
||||
|
||||
$user = AuthService::decryptAuthData($authorization);
|
||||
if (!$user) throw new ApiException(403, '未登录或登陆已过期');
|
||||
if (!$user) throw new ApiException('未登录或登陆已过期', 403);
|
||||
$request->merge([
|
||||
'user' => $user
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user