fix: 修改退出账号功能
This commit is contained in:
		| @@ -31,9 +31,6 @@ public class LoginController { | ||||
|     @Autowired | ||||
|     private LoginService loginService; | ||||
|  | ||||
|     @Autowired | ||||
|     private LogoutSuccessHandlerImpl logoutSuccessHandler; | ||||
|  | ||||
|     @PostMapping("/login") | ||||
|     @ApiOperation(value = "登录") | ||||
|     public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) { | ||||
|   | ||||
| @@ -14,5 +14,4 @@ public interface LoginService { | ||||
|  | ||||
|     ResponseResult login(HttpServletRequest request, LoginParam loginParam); | ||||
|  | ||||
|     ResponseResult logout(); | ||||
| } | ||||
|   | ||||
| @@ -50,14 +50,4 @@ public class LoginServiceImpl implements LoginService { | ||||
|         return new ResponseResult(200,"登录成功",map); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ResponseResult logout() { | ||||
|         //获取SecurityContextHolder中的用户id | ||||
|         UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); | ||||
|         LoginUser loginUser = (LoginUser) authentication.getPrincipal(); | ||||
|         String userid = loginUser.getSysUserEntity().getId().toString(); | ||||
|         //删除redis中的值 | ||||
|         redisTemplate.delete("login:"+userid); | ||||
|         return new ResponseResult(200,"注销成功"); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user