初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
@@ -8,7 +8,11 @@ use Illuminate\Http\JsonResponse;
|
||||
|
||||
class LoginController extends BaseController
|
||||
{
|
||||
//
|
||||
/**
|
||||
* 登录控制器注册在免登录组里,继承来的 CRUD 会变成 /api/list、/api/create 这种
|
||||
* 无需鉴权、指向 LoginService(根本没有这些方法)的路由,必须排除
|
||||
*/
|
||||
protected array $exceptRoute = ['list', 'option', 'detail', 'create', 'update', 'delete'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -54,20 +58,32 @@ class LoginController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
public function logout()
|
||||
/**
|
||||
* 退出登录
|
||||
* @Method POST
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function logout(): JsonResponse
|
||||
{
|
||||
return jok(
|
||||
[],
|
||||
$this->service->logout(),
|
||||
'退出成功'
|
||||
);
|
||||
}
|
||||
|
||||
public function codes()
|
||||
/**
|
||||
* 续签 token
|
||||
*
|
||||
* 前端拦截器在 401 时调用,此时 token 已过期,所以只能放在免登录组里,
|
||||
* 由 LoginService::refresh 自己校验签名与 Redis 会话。
|
||||
* @Method POST
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function refresh(): JsonResponse
|
||||
{
|
||||
return jok(
|
||||
[],
|
||||
'获取成功'
|
||||
$this->service->refresh(),
|
||||
'续签成功'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user