|
@@ -73,21 +73,21 @@ public class ApiInterceptor implements HandlerInterceptor {
|
|
|
String ip = EncryptUtils.getIp(appId);
|
|
|
|
|
|
// 校验appId登记id是否跟请求ip类型一致
|
|
|
- SysIpEntity entity = ipService.findByIdentifier(appId);
|
|
|
- if (!entity.getIp().equals(ip)){
|
|
|
- String errorMsg = StrUtil.format("此ip: {} 没有登记, 拒绝访问", remoteAddr);
|
|
|
- log.error(errorMsg);
|
|
|
- BaseRuntimeException.getExc(null, errorMsg);
|
|
|
- return false;
|
|
|
- }
|
|
|
-// List<String> ips= ipService.findByProjectId(projectId);
|
|
|
-// if (!ips.contains(remoteAddr)) {
|
|
|
+// SysIpEntity entity = ipService.findByIdentifier(appId);
|
|
|
+// if (!entity.getIp().equals(ip)){
|
|
|
// String errorMsg = StrUtil.format("此ip: {} 没有登记, 拒绝访问", remoteAddr);
|
|
|
// log.error(errorMsg);
|
|
|
// BaseRuntimeException.getExc(null, errorMsg);
|
|
|
// return false;
|
|
|
// }
|
|
|
- redisUtil.setEx(appKey, appId, 3, TimeUnit.SECONDS);
|
|
|
+ List<String> ips= ipService.findByType(appId);
|
|
|
+ if (!ips.contains(remoteAddr)) {
|
|
|
+ String errorMsg = StrUtil.format("此ip: {} 没有登记, 拒绝访问", remoteAddr);
|
|
|
+ log.error(errorMsg);
|
|
|
+ BaseRuntimeException.getExc(null, errorMsg);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ redisUtil.setEx(appKey, appId, 5, TimeUnit.SECONDS);
|
|
|
|
|
|
return true;
|
|
|
}
|