mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-15 06:23:44 +08:00
更新2.1.2版本,优化部门、角色权限,增加上下级关系;增加登录、系统、短信日志;优化省市区编码
This commit is contained in:
@@ -144,6 +144,11 @@ func GetPublicIP(ctx context.Context) (ip string, err error) {
|
||||
g.Log().Warningf(ctx, "GetPublicIP alternatives are being tried err:%+v", err)
|
||||
return GetPublicIP2()
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
g.Log().Warningf(ctx, "publicIP address Parsing failure, check the network and firewall blocking.")
|
||||
return "0.0.0.0", nil
|
||||
}
|
||||
return data.Ip, nil
|
||||
}
|
||||
|
||||
@@ -190,5 +195,10 @@ func GetClientIp(r *ghttp.Request) string {
|
||||
if ip == "" {
|
||||
ip = r.GetClientIp()
|
||||
}
|
||||
|
||||
// 如果存在多个,默认取第一个
|
||||
if gstr.Contains(ip, ",") {
|
||||
ip = gstr.TrimStr(ip, ",", -1)
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
Reference in New Issue
Block a user