1.update unknow ip from 0 to '未知ip'

main
Gary 10 months ago
parent 476990c5ce
commit 3aa830fc78

@ -28,7 +28,8 @@ public class IpUtil {
try {
String ipLocation = searcher.search(ip);
if (ipLocation.startsWith(Constants.IP_LOCATION_CHINA)) {
return ipLocation.split("\\|")[2].replaceFirst("省", "");
String province = ipLocation.split("\\|")[2].replaceFirst("省", "");
return "0".equals(province)?UNKNOW_IP:province;
}
if (ipLocation.contains(INTERNAL_IP)) {
return INTERNAL_IP;

@ -27,7 +27,8 @@ public class IpUtil {
try {
String ipLocation = searcher.search(ip);
if (ipLocation.startsWith(Constants.IP_LOCATION_CHINA)) {
return ipLocation.split("\\|")[2].replaceFirst("省", "");
String province = ipLocation.split("\\|")[2].replaceFirst("省", "");
return "0".equals(province)?UNKNOW_IP:province;
}
if (ipLocation.contains(INTERNAL_IP)) {
return INTERNAL_IP;

@ -16,6 +16,9 @@ public class IpUtilTest {
String ip3="192.168.3.0";
System.out.println(IpUtil.getIpLocation(ip3));
String ip4="39.144.187.227";
System.out.println(IpUtil.getIpLocation(ip4));
}
}

Loading…
Cancel
Save