Commit 6d054b70 by 袁伟铭

1.0.0

parent f7904cec
...@@ -26,9 +26,9 @@ public class ApiInterceptor extends HandlerInterceptorAdapter { ...@@ -26,9 +26,9 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
@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 uri = request.getRequestURI(); String ip = ServletUtil.getClientIP(request);
String queryString = request.getQueryString();
log.debug("请求URI: {}", request.getRequestURL()); log.debug("{}请求URI: {}", ip, request.getRequestURL());
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
...@@ -42,7 +42,6 @@ public class ApiInterceptor extends HandlerInterceptorAdapter { ...@@ -42,7 +42,6 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
} }
// 黑名单 // 黑名单
String ip = ServletUtil.getClientIP(request);
String blackIps = ConfigCache.getValue("API.IP.BLACK"); String blackIps = ConfigCache.getValue("API.IP.BLACK");
if (StrUtil.isNotBlank(ip) && StrUtil.isNotBlank(blackIps)) { if (StrUtil.isNotBlank(ip) && StrUtil.isNotBlank(blackIps)) {
List<String> ipList = Arrays.asList(blackIps.split(",")); List<String> ipList = Arrays.asList(blackIps.split(","));
...@@ -72,7 +71,7 @@ public class ApiInterceptor extends HandlerInterceptorAdapter { ...@@ -72,7 +71,7 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
// 调试日志 // 调试日志
if (ApiUtils.DEBUG) { if (ApiUtils.DEBUG) {
log.info("API DEBUG INTERCEPTOR \n[path=" + uri + "/" + queryString + "]" log.info("API DEBUG INTERCEPTOR \n[path=" + request.getRequestURI() + "/" + request.getQueryString() + "]"
+ "[from:" + form + "]" + "[from:" + form + "]"
+ "\n[time=" + (System.currentTimeMillis() - start) + "ms]"); + "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment