提交代码

dev-discount
胡锐 2 years ago
parent 9dfac24d77
commit a2c34b5ee4
  1. 13
      hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java

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

Loading…
Cancel
Save