2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.landtool.lanbase.modules.api.utils;
 
import java.net.Inet4Address;
import java.net.InetAddress;
 
public class GetWebProUrl {
    public static String getLocalHostIP(){
        String result = null;
 
        try {
 
            InetAddress IP = Inet4Address.getLocalHost();
            String ip = IP.toString();
 
            int index = ip.indexOf('/');
 
            result = ip.substring(index+1, ip.length());
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        return result;
    }
 
    public static String getProjectURL(String IP){
        String result = "http://";
 
        result += IP;
        result += ":8080/";
 
        String proPath = System.getProperty("user.dir");
        String proName = proPath.substring(proPath.lastIndexOf("\\")+1, proPath.length());
 
        result += proName;
 
        return result;
    }
}