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