diff --git a/src/main/java/com/yipin/liuwanr/filter/AuthInterceptor.java b/src/main/java/com/yipin/liuwanr/filter/AuthInterceptor.java index 5f53dca..8e68ef3 100644 --- a/src/main/java/com/yipin/liuwanr/filter/AuthInterceptor.java +++ b/src/main/java/com/yipin/liuwanr/filter/AuthInterceptor.java @@ -38,15 +38,16 @@ public class AuthInterceptor implements HandlerInterceptor { Object loginStatus = ops.get(token); //userid String userId = request.getParameter("userId"); - if (!StringUtils.isEmpty(userId)){ - return userId.equals(ops.get(token)); - } - if( Objects.isNull(loginStatus)){ response.getWriter().print("1");//token错误 return false; + }else { + if (!StringUtils.isEmpty(userId)){ + return userId.equals(loginStatus); + }else { + return false; + } } - return true; } @Override