mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-11-12 12:13:50 +08:00
update 删除通用工具 改为使用hutool
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package com.ruoyi.common.utils.ip;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 获取地址类
|
||||
@@ -36,7 +36,7 @@ public class AddressUtils
|
||||
try
|
||||
{
|
||||
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
|
||||
if (StringUtils.isEmpty(rspStr))
|
||||
if (StrUtil.isEmpty(rspStr))
|
||||
{
|
||||
log.error("获取地理位置异常 {}", ip);
|
||||
return UNKNOWN;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.ruoyi.common.utils.ip;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.html.EscapeUtil;
|
||||
|
||||
/**
|
||||
* 获取IP方法
|
||||
@@ -41,7 +42,7 @@ public class IpUtils
|
||||
{
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip);
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : HtmlUtil.cleanHtmlTag(ip);
|
||||
}
|
||||
|
||||
public static boolean internalIp(String ip)
|
||||
@@ -52,7 +53,7 @@ public class IpUtils
|
||||
|
||||
private static boolean internalIp(byte[] addr)
|
||||
{
|
||||
if (StringUtils.isNull(addr) || addr.length < 2)
|
||||
if (Validator.isNull(addr) || addr.length < 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user