Commit 7e12af4d authored by litengwei's avatar litengwei

设备平台登陆失效问题

parent 813058a3
......@@ -30,6 +30,8 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
......@@ -86,9 +88,14 @@ public class LoginController {
reginParams = getLogin(userId, token);
}else{
RequestContext.setProduct(product);
if (!TokenOperation.refresh(reginParams.getToken())) {
reginParams = getLogin(userId, token);
}
String cacheKey = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", RequestContext.getProduct(), reginParams.getToken()});
boolean hasKey = Redis.getRedisTemplate().hasKey(cacheKey);
if (hasKey) {
return reginParams;
} else {
logger.info("Auto自动登陆=====:{}", JSON.toJSONString(reginParams));
reginParams = getLogin(userId, token);
}
}
return reginParams;
}
......
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