提交 7078bbf8 编写于 作者: F fengyw

增加构建工具

上级 5d00371c
......@@ -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);
......
......@@ -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::";
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册