fix 代码生成-父级菜单,状态字段优化

This commit is contained in:
yxh
2024-10-22 11:49:36 +08:00
parent 70b54b5b1a
commit 3f82130418
17 changed files with 262 additions and 204 deletions

View File

@@ -34,12 +34,18 @@ func EncryptPassword(password, salt string) string {
// GetDomain 获取当前请求接口域名
func GetDomain(ctx context.Context) string {
r := g.RequestFromCtx(ctx)
pathInfo, err := gurl.ParseURL(r.GetUrl(), -1)
if err != nil {
g.Log().Error(ctx, err)
return ""
host := r.Header.Get("X-Forwarded-Host")
if host == "" {
host = r.Header.Get("X-Host")
}
return fmt.Sprintf("%s://%s:%s/", pathInfo["scheme"], pathInfo["host"], pathInfo["port"])
if host == "" {
host = r.Host
}
scheme := r.Header.Get("X-Scheme")
if scheme == "" {
scheme = r.GetSchema()
}
return fmt.Sprintf("%s://%s", scheme, host)
}
// GetClientIp 获取客户端IP