refactor: fix 在线获取地IP址位置失败
This commit is contained in:
@@ -34,7 +34,7 @@ public class OnlineIpRegionUtil {
|
||||
}
|
||||
if (AgileBootConfig.isAddressEnabled()) {
|
||||
try {
|
||||
String rspStr = HttpUtil.get(ADDRESS_QUERY_SITE + "ip=" + ip + "&json=true",
|
||||
String rspStr = HttpUtil.get(ADDRESS_QUERY_SITE + "?ip=" + ip + "&json=true",
|
||||
CharsetUtil.CHARSET_GBK);
|
||||
|
||||
if (StrUtil.isEmpty(rspStr)) {
|
||||
|
||||
@@ -22,13 +22,10 @@ public class OnlineIpRegionUtilTest {
|
||||
|
||||
@Test
|
||||
public void getIpRegionWithIpv4() {
|
||||
IpRegion ipRegion = OnlineIpRegionUtil.getIpRegion("110.81.189.80");
|
||||
IpRegion ipRegion = OnlineIpRegionUtil.getIpRegion("120.42.247.130");
|
||||
|
||||
if (ipRegion != null) {
|
||||
Assert.assertEquals("中国", ipRegion.getCountry());
|
||||
Assert.assertEquals("福建省", ipRegion.getProvince());
|
||||
Assert.assertEquals("泉州市", ipRegion.getCity());
|
||||
}
|
||||
Assert.assertEquals("福建省", ipRegion.getProvince());
|
||||
Assert.assertEquals("泉州市", ipRegion.getCity());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user