领奖励改为IP段3位
This commit is contained in:
parent
e8075d5384
commit
98778761ff
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user