param(); $token = $auth->attempt($params); return CatchResponse::success([ 'token' => $token, ], '登录成功'); } catch (\Exception $exception) { $code = $exception->getCode(); return CatchResponse::fail($code == Code::USER_FORBIDDEN ? '该账户已被禁用,请联系管理员' : '登录失败,请检查邮箱和密码', Code::LOGIN_FAILED); } } /** * 登出 * * @time 2019年11月28日 * @return \think\response\Json */ public function logout(): \think\response\Json { return CatchResponse::success(); } /** * refresh token * * @author JaguarJack * @email njphper@gmail.com * @time 2020/5/18 * @return \think\response\Json */ public function refreshToken() { return CatchResponse::success([ 'token' => JWTAuth::refresh() ]); } }