Commit 9e85d9e4 by qwmqiuwenmin

fix

parent a6bc6fd1
......@@ -17,6 +17,7 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -66,13 +67,23 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
if (null != ignoreLogin) {
return true;
}
//LoginVO loginUser = (LoginVO) AuthRequestUtil.getAppLoginUser(token);
// if (loginUser == null) {
// this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
// logger.info("用户不存在!");
// return false;
// }
Cookie[] cookies = AuthRequestUtil.getRequest().getCookies();
String token = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("token")){
token = cookie.getValue();
}
}
}
LoginVO loginUser = (LoginVO) AuthRequestUtil.getAppLoginUser(token);
if (loginUser == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
logger.info("用户不存在!");
return false;
}
HandlerMethod method = null;
if (o instanceof HandlerMethod) {
method = (HandlerMethod) (o);
......@@ -81,12 +92,12 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
return true;
}
MenuCheck methodAnnotation = method.getMethodAnnotation(MenuCheck.class);
// if (StringUtils.isNotBlank(loginUser.getWxEnterpriseId())) {
// httpServletRequest.setAttribute("wxEnterpriseId", loginUser.getWxEnterpriseId());
// }
// if (loginUser.getStaffDTO() != null) {
// httpServletRequest.setAttribute("staffDTO", loginUser.getStaffDTO());
// }
if (StringUtils.isNotBlank(loginUser.getWxEnterpriseId())) {
httpServletRequest.setAttribute("wxEnterpriseId", loginUser.getWxEnterpriseId());
}
if (loginUser.getStaffDTO() != null) {
httpServletRequest.setAttribute("staffDTO", loginUser.getStaffDTO());
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment