From 98778761ff39e44848ca0a68311884257bfa9cee Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 26 Feb 2026 18:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=A5=96=E5=8A=B1=E6=94=B9=E4=B8=BAIP?= =?UTF-8?q?=E6=AE=B53=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/device/impl/LatestMobileDeviceServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/device/impl/LatestMobileDeviceServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/device/impl/LatestMobileDeviceServiceImpl.java index 408ec23f..25588ffe 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/device/impl/LatestMobileDeviceServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/device/impl/LatestMobileDeviceServiceImpl.java @@ -373,8 +373,8 @@ public class LatestMobileDeviceServiceImpl extends /** * 获取IP前缀段 - * IPv4: 取前2段(如 192.168.1.100 -> 192.168) - * IPv6: 取前2段(如 2402:ad80:130:d1a2::1 -> 2402:ad80) + * IPv4: 取前3段(如 192.168.1.100 -> 192.168.1) + * IPv6: 取前3段(如 2402:ad80:130:d1a2::1 -> 2402:ad80:130) */ private String getIpPrefix(String ip) { if (StringUtils.isBlank(ip)) { @@ -385,8 +385,8 @@ public class LatestMobileDeviceServiceImpl extends String joinChar = ip.contains(":") ? ":" : "."; String[] parts = ip.split(separator); - if (parts.length >= 2) { - return parts[0] + joinChar + parts[1]; + if (parts.length >= 3) { + return parts[0] + joinChar + parts[1] + joinChar + parts[2]; } return ip; }