|  | @@ -4,6 +4,9 @@ import java.io.IOException;
 | 
	
		
			
				|  |  |  import javax.servlet.ServletException;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.ylx.common.core.domain.model.WxLoginUser;
 | 
	
		
			
				|  |  | +import com.ylx.framework.web.service.WxTokenService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.context.annotation.Configuration;
 | 
	
		
			
				|  |  |  import org.springframework.security.core.Authentication;
 | 
	
	
		
			
				|  | @@ -25,11 +28,14 @@ import com.ylx.framework.web.service.TokenService;
 | 
	
		
			
				|  |  |   * @author ylx
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  @Configuration
 | 
	
		
			
				|  |  | -public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
 | 
	
		
			
				|  |  | -{
 | 
	
		
			
				|  |  | +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TokenService tokenService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private WxTokenService wxTokenService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 退出处理
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -37,16 +43,26 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
 | 
	
		
			
				|  |  | -            throws IOException, ServletException
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | +            throws IOException, ServletException {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          LoginUser loginUser = tokenService.getLoginUser(request);
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotNull(loginUser))
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotNull(loginUser)) {
 | 
	
		
			
				|  |  |              String userName = loginUser.getUsername();
 | 
	
		
			
				|  |  |              // 删除用户缓存记录
 | 
	
		
			
				|  |  |              tokenService.delLoginUser(loginUser.getToken());
 | 
	
		
			
				|  |  |              // 记录用户退出日志
 | 
	
		
			
				|  |  |              AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, MessageUtils.message("user.logout.success")));
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            WxLoginUser wxUser = wxTokenService.getWxUser(request);
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotNull(wxUser)) {
 | 
	
		
			
				|  |  | +                String userName = wxUser.getUsername();
 | 
	
		
			
				|  |  | +                // 删除用户缓存记录
 | 
	
		
			
				|  |  | +                tokenService.delLoginUser(wxUser.getToken());
 | 
	
		
			
				|  |  | +                // 记录用户退出日志
 | 
	
		
			
				|  |  | +                AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, MessageUtils.message("user.logout.success")));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.success(MessageUtils.message("user.logout.success"))));
 | 
	
		
			
				|  |  |      }
 |