diff --git a/roncoo-education-app-gateway/src/main/java/com/roncoo/education/app/gateway/filter/EduGlobalFilter.java b/roncoo-education-app-gateway/src/main/java/com/roncoo/education/app/gateway/filter/EduGlobalFilter.java index 23e92c4cfdc3233365cbb705f06d36eb1afd573d..8f3b714876e3863ff697c392259ffb05d8bda608 100644 --- a/roncoo-education-app-gateway/src/main/java/com/roncoo/education/app/gateway/filter/EduGlobalFilter.java +++ b/roncoo-education-app-gateway/src/main/java/com/roncoo/education/app/gateway/filter/EduGlobalFilter.java @@ -61,16 +61,16 @@ public class EduGlobalFilter implements GlobalFilter, Ordered { if (FilterUtil.checkUri(uri, FilterUtil.ADMIN_URL_PREFIX)) { // admin校验 - if (!stringRedisTemplate.hasKey(RedisPreEnum.ADMINI_MENU.getCode().concat(userId.toString()))) { + if (!stringRedisTemplate.hasKey(Constants.RedisPre.ADMINI_MENU.concat(userId.toString()))) { throw new BaseException(ResultEnum.MENU_PAST); } - String tk = stringRedisTemplate.opsForValue().get(RedisPreEnum.ADMINI_MENU.getCode().concat(userId.toString())); + String tk = stringRedisTemplate.opsForValue().get(Constants.RedisPre.ADMINI_MENU.concat(userId.toString())); // 校验接口是否有权限 if (!checkUri(uri, tk)) { throw new BaseException(ResultEnum.MENU_NO); } // 更新时间,使用户菜单不过期 - stringRedisTemplate.opsForValue().set(RedisPreEnum.ADMINI_MENU.getCode().concat(userId.toString()), tk, Constants.SESSIONTIME, TimeUnit.MINUTES); + stringRedisTemplate.opsForValue().set(Constants.RedisPre.ADMINI_MENU.concat(userId.toString()), tk, Constants.SESSIONTIME, TimeUnit.MINUTES); } request.mutate().header(Constants.USER_ID, String.valueOf(userId)); return chain.filter(exchange); diff --git a/roncoo-education-common/roncoo-education-common-core/src/main/java/com/roncoo/education/common/core/tools/Constants.java b/roncoo-education-common/roncoo-education-common-core/src/main/java/com/roncoo/education/common/core/tools/Constants.java index cd42d37d0c6cccbe3b5fff86e18000c8488367f8..aaeea9434959501258bc3d2908f335a49612f2fa 100644 --- a/roncoo-education-common/roncoo-education-common-core/src/main/java/com/roncoo/education/common/core/tools/Constants.java +++ b/roncoo-education-common/roncoo-education-common-core/src/main/java/com/roncoo/education/common/core/tools/Constants.java @@ -12,17 +12,22 @@ public final class Constants { private Constants() { } + // 手机号码校验 public static final String REGEX_MOBILE = "^((13[0-9])|(14[5,7,9])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199)\\d{8}$"; - public static final String ADMIN = "admin"; + public static final String ADMIN = "admin"; public static final String TOKEN = "token"; public static final String USER_ID = "userId"; - public static final Integer FREEZE = 3; + public static final Integer FREEZE = 3; /** * 单位:分钟 */ public final static int SESSIONTIME = 40; + public interface RedisPre { + String ADMINI_MENU = "admin::menu::"; + } + }