소스 검색

fix:IP黑名单增加log日志

hidewnd 2 달 전
부모
커밋
5f4cdb65ce
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      yt-question/yt-question-service/src/main/java/com/ytpm/question/config/interceptor/HttpInterceptor.java

+ 2 - 1
yt-question/yt-question-service/src/main/java/com/ytpm/question/config/interceptor/HttpInterceptor.java

@@ -49,7 +49,8 @@ public class HttpInterceptor implements HandlerInterceptor {
         String serviceName = StrUtil.replace(applicationName, "-service", "");
         String str = redisService.getStr(StrUtil.format("blackIps:{}", serviceName));
         if (StrUtil.isNotEmpty(str) && Arrays.asList(str.split(",")).contains(clientIp)) {
-            throw new CommonException(StrUtil.format("{} not allow request:{}", clientIp, requestURI));
+            log.warn(StrUtil.format("[{}] not allow request:{}", clientIp, requestURI));
+            throw new CommonException("not allow request");
         }
     }