RuoYi
2023-02-21 ad76d4301c1b37a316b58a020d70817d3d89fad0
src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java
@@ -2,7 +2,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
@@ -25,7 +26,6 @@
    public static String getRealAddressByIP(String ip)
    {
        String address = UNKNOWN;
        // 内网不查询
        if (IpUtils.internalIp(ip))
        {
@@ -41,7 +41,7 @@
                    log.error("获取地理位置异常 {}", ip);
                    return UNKNOWN;
                }
                JSONObject obj = JSONObject.parseObject(rspStr);
                JSONObject obj = JSON.parseObject(rspStr);
                String region = obj.getString("pro");
                String city = obj.getString("city");
                return String.format("%s %s", region, city);
@@ -51,6 +51,6 @@
                log.error("获取地理位置异常 {}", ip);
            }
        }
        return address;
        return UNKNOWN;
    }
}