Browse Source

fix:IP黑名单增加log日志

hidewnd 1 day ago
parent
commit
5f4cdb65ce

+ 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");
         }
     }