feat(auth): 实现用户退出登录功能
- 在网关过滤器中增加对未登录异常的处理 - 完善用户登出接口,调用 Sa-Token 的登出方法 - 新增 UserService 中的 logout 方法实现 - 优化获取用户 ID 的逻辑并增强异常处理 - 清理 Sa-Token 上下文避免内存泄漏
This commit is contained in:
@@ -29,8 +29,7 @@ public class UserController {
|
||||
@ApiOperationLog(description = "账号登出")
|
||||
public Response<?> logout(@RequestHeader("userId") String userId) {
|
||||
log.info("==> 网关透传过来的用户 ID: {}", userId);
|
||||
// todo 账号退出登录逻辑待实现
|
||||
|
||||
return Response.success();
|
||||
Long userIdLong = Long.parseLong(userId);
|
||||
return userService.logout(userIdLong);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user