Browse Source

1、增加服务器启动时从redis获取模块期限数据

master
bjang03 6 months ago
parent
commit
56c8c3fbdf
  1. 7
      win-framework/win-spring-boot-starter-web/src/main/java/com/win/framework/web/core/filter/ModuleAuthenInterceptor.java

7
win-framework/win-spring-boot-starter-web/src/main/java/com/win/framework/web/core/filter/ModuleAuthenInterceptor.java

@ -18,13 +18,14 @@ public class ModuleAuthenInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String endTimeStr = ModuleAuthenUtils.module.getStr(md5.digestHex(request.getRequestURI().split("/")[1]),null);
String moduleName = request.getRequestURI().split("/")[1];
String endTimeStr = ModuleAuthenUtils.module.getStr(md5.digestHex(moduleName),null);
if(endTimeStr == null || "".equals(endTimeStr)){
throw new Exception("没有当前模块使用权限,请联系服务商缴费开通");
throw new Exception(String.format("没有【%s】模块使用权限,请联系服务商缴费开通",moduleName));
}
LocalDateTime endTime = LocalDateTime.parse(ModuleAuthenUtils.decrypt(endTimeStr,ModuleAuthenUtils.secretKey), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if (endTime == null || endTime.isBefore(LocalDateTime.now())){
throw new Exception("权限到期或没有当前模块使用权限,请联系服务商缴费");
throw new Exception(String.format("【%s】模块权限到期,请联系服务商缴费", moduleName));
}
return true;
}

Loading…
Cancel
Save