|
@@ -43,7 +43,7 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
|
throws Exception {
|
|
throws Exception {
|
|
//System.out.println("preHandle");
|
|
//System.out.println("preHandle");
|
|
- String deviceId = request.getHeader("deviceId");
|
|
|
|
|
|
+
|
|
String token = request.getHeader(ACCESSTOKEN);
|
|
String token = request.getHeader(ACCESSTOKEN);
|
|
// String time = request.getHeader("time");
|
|
// String time = request.getHeader("time");
|
|
log.info(request.getRequestURI());
|
|
log.info(request.getRequestURI());
|
|
@@ -67,13 +67,7 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
|
|
|
|
log.info("---interceptertoken");
|
|
log.info("---interceptertoken");
|
|
log.info(token);
|
|
log.info(token);
|
|
- if (StringUtils.isEmpty(deviceId)) {
|
|
|
|
|
|
|
|
- //response.getWriter().print("");
|
|
|
|
- log.info("*********************》deviceId错误");
|
|
|
|
- throw new RRException("deviceId错误", 102);
|
|
|
|
- //return false;
|
|
|
|
- }
|
|
|
|
if (StringUtils.isEmpty(token)) {
|
|
if (StringUtils.isEmpty(token)) {
|
|
log.info("*********************》token为空");
|
|
log.info("*********************》token为空");
|
|
throw new RRException("token错误,请重新登录", 101);
|
|
throw new RRException("token错误,请重新登录", 101);
|
|
@@ -87,7 +81,7 @@ public class AuthIntercepter implements HandlerInterceptor {
|
|
log.info("************************************》");
|
|
log.info("************************************》");
|
|
Long userId = TokenUtils.getUserId(token);
|
|
Long userId = TokenUtils.getUserId(token);
|
|
log.info("userId={}",userId);
|
|
log.info("userId={}",userId);
|
|
- Object obj = redisTemplate.opsForValue().get(Long.toString(userId));
|
|
|
|
|
|
+ Object obj = redisTemplate.opsForValue().get("user");
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
log.info("************************用户token不存在");
|
|
log.info("************************用户token不存在");
|
|
throw new RRException("token过期", 101);
|
|
throw new RRException("token过期", 101);
|