若依 3.1

This commit is contained in:
RuoYi
2018-12-01 16:14:19 +08:00
parent 451caf12fc
commit 6a592827e8
41 changed files with 2004 additions and 5547 deletions

View File

@ -1,5 +1,7 @@
package com.ruoyi.common.utils;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest;
/**
@ -155,4 +157,28 @@ public class IpUtils
}
return bytes;
}
public static String getHostIp()
{
try
{
return InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException e)
{
}
return "127.0.0.1";
}
public static String getHostName()
{
try
{
return InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException e)
{
}
return "未知";
}
}