|
@@ -1,11 +1,11 @@
|
|
|
package cn.com.ctop.okr.controller;
|
|
|
|
|
|
import cn.com.ctop.okr.entity.QYWxUserInfo;
|
|
|
-import cn.com.ctop.okr.qywx.constant.QYWxConstant;
|
|
|
import cn.com.ctop.okr.service.CorpUserInfoService;
|
|
|
import cn.com.ctop.okr.service.QYWxService;
|
|
|
import cn.com.ctop.okr.utils.JwtUtil;
|
|
|
import cn.com.ctop.okr.utils.RedisUtil;
|
|
|
+import cn.com.ctop.okr.vo.LoginUser;
|
|
|
import cn.com.ctop.okr.vo.Result;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.val;
|
|
@@ -15,6 +15,8 @@ import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
|
|
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
|
|
|
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
|
|
|
import org.apache.log4j.Logger;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
+import org.apache.shiro.subject.Subject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -22,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
@Controller
|
|
|
@RequestMapping("/sys")
|
|
|
public class LoginController {
|
|
@@ -170,5 +175,26 @@ public class LoginController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 退出登录
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "/logout")
|
|
|
+ public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ //用户退出逻辑
|
|
|
+ Subject subject = SecurityUtils.getSubject();
|
|
|
+ //LoginUser sysUser = (LoginUser) subject.getPrincipal();
|
|
|
+ QYWxUserInfo sysUser = (QYWxUserInfo) subject.getPrincipal();
|
|
|
+
|
|
|
+ logger.info(" 用户名: " + sysUser.getName() + ",退出成功! ");
|
|
|
+ subject.logout();
|
|
|
+
|
|
|
+ return Result.ok("退出登录成功!");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|