From 476990c5ce2e3d55fb4ae64b8d37551ccd13ddfa Mon Sep 17 00:00:00 2001 From: wangqing <408564126@qq.com> Date: Wed, 20 Mar 2024 06:13:55 +0800 Subject: [PATCH] fix IpUtil unknow ip --- luoo_comment/src/main/java/com/luoo/comment/util/IpUtil.java | 3 +++ luoo_user/src/main/java/com/luoo/user/util/IpUtil.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/luoo_comment/src/main/java/com/luoo/comment/util/IpUtil.java b/luoo_comment/src/main/java/com/luoo/comment/util/IpUtil.java index 529fda5..d0c1175 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/util/IpUtil.java +++ b/luoo_comment/src/main/java/com/luoo/comment/util/IpUtil.java @@ -33,6 +33,9 @@ public class IpUtil { if (ipLocation.contains(INTERNAL_IP)) { return INTERNAL_IP; } + if (ipLocation.startsWith("0")){ + return UNKNOW_IP; + } return ipLocation.split("\\|")[0]; } catch (Exception e) { return UNKNOW_IP; diff --git a/luoo_user/src/main/java/com/luoo/user/util/IpUtil.java b/luoo_user/src/main/java/com/luoo/user/util/IpUtil.java index 9a1e793..5a60036 100644 --- a/luoo_user/src/main/java/com/luoo/user/util/IpUtil.java +++ b/luoo_user/src/main/java/com/luoo/user/util/IpUtil.java @@ -32,6 +32,9 @@ public class IpUtil { if (ipLocation.contains(INTERNAL_IP)) { return INTERNAL_IP; } + if (ipLocation.startsWith("0")){ + return UNKNOW_IP; + } return ipLocation.split("\\|")[0]; } catch (Exception e) { return UNKNOW_IP;