|
|
|
@ -22,13 +22,16 @@ public class BaiduUtils { |
|
|
|
|
*/ |
|
|
|
|
public static JSONObject ipLocation(String ip) { |
|
|
|
|
System.out.println(ip); |
|
|
|
|
if (ip != null) { |
|
|
|
|
JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
if (ip != null) { |
|
|
|
|
JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); |
|
|
|
|
return response; |
|
|
|
|
} else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|