build: 退出登录的接口检查是否有用户

This commit is contained in:
CaptainB 2023-09-19 12:31:28 +08:00 committed by 刘瑞斌
parent 4a531c2334
commit ebd651ea94

View File

@ -85,7 +85,10 @@ public class LoginController {
@GetMapping(value = "/signout")
@Operation(summary = "退出登录")
public ResultHolder logout(HttpServletResponse response) throws Exception {
public ResultHolder logout() throws Exception {
if (SessionUtils.getUser() == null) {
return ResultHolder.success("logout success");
}
baseUserService.saveLog(SessionUtils.getUserId(), HttpMethodConstants.GET.name(), "/signout", "登出成功", OperationLogType.LOGOUT.name());
SecurityUtils.getSubject().logout();
return ResultHolder.success("logout success");