领奖励改为IP段3位

This commit is contained in:
tianfeng 2026-02-26 18:37:48 +08:00
parent e8075d5384
commit 98778761ff

View File

@ -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;
}