You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
705 B
30 lines
705 B
package com.hai.common.utils;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
/**
|
|
* 百度工具
|
|
* @className: BaiduUtis
|
|
* @author: HuRui
|
|
* @date: 2022/10/21
|
|
**/
|
|
public class BaiduUtils {
|
|
|
|
private static Logger log = LoggerFactory.getLogger(BaiduUtils.class);
|
|
|
|
/**
|
|
* IP 定位
|
|
* @param ip ip地址
|
|
* @return
|
|
*/
|
|
public static JSONObject ipLocation(String ip) {
|
|
JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip);
|
|
log.info(response.toJSONString());
|
|
return response;
|
|
}
|
|
|
|
|
|
}
|
|
|