Commit d7d9c04b by qwmqiuwenmin

fix

parent 31d949c2
......@@ -46,8 +46,7 @@ public class AuthRequestUtil {
getSession().removeAttribute(LOGIN_SESSION_KEY);
}
public static Object getAppLoginUser() {
String token = getRequest().getHeader("token");
public static Object getAppLoginUser(String token) {
logger.info("token1111111111=" + token);
if (StringUtils.isBlank(token)) {
return null;
......@@ -99,7 +98,7 @@ public class AuthRequestUtil {
public static void setAppLoginUser(String token, Object obj) {
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
setLoginUserLastToken(token, obj);
//setLoginUserLastToken(token, obj);
}
public static void setAppFakeLoginUser(String token, Object obj) {
......@@ -113,11 +112,10 @@ public class AuthRequestUtil {
RedisUtil.delCache(token);
}
public static void setAppLoginUser(Object obj) {
String token = getRequest().getHeader("token");
public static void setAppLoginUser(Object obj,String token) {
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
setLoginUserLastToken(token, obj);
//setLoginUserLastToken(token, obj);
}
public static void setAppFakeLoginUser(Object obj) {
String token = getRequest().getHeader("token");
......
......@@ -29,6 +29,7 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
......@@ -114,7 +115,17 @@ public class LoginController extends WebBaseController{
@RequestMapping("get-login-info")
public HaobanResponse getLoginInfo(){
LoginVO loginVO = (LoginVO) AuthRequestUtil.getSessionUser();
Cookie[] cookies = AuthRequestUtil.getRequest().getCookies();
String token = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("token")){
token = cookie.getValue();
}
}
}
LoginVO loginVO = (LoginVO) AuthRequestUtil.getAppLoginUser(token);
return resultResponse(HaoBanErrCode.ERR_1,loginVO);
}
......
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