From 2982cf16ddb83ef2ad9e349f3f8362dda04d37ad Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 17 Aug 2024 18:08:55 +0800 Subject: [PATCH] update --- app/svc/svc_master.go | 49 +++++++++++++++---------------------------- go.mod | 2 +- k8s/ingress.yaml | 2 +- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/app/svc/svc_master.go b/app/svc/svc_master.go index ccd792a..74f6300 100644 --- a/app/svc/svc_master.go +++ b/app/svc/svc_master.go @@ -1,6 +1,10 @@ package svc import ( + "applet/app/e" + "applet/app/utils" + db "code.fnuoos.com/zhimeng/model.git/src" + "code.fnuoos.com/zhimeng/model.git/src/super/implement" "fmt" "github.com/gin-gonic/gin" "strconv" @@ -15,38 +19,19 @@ func GetMasterId(c *gin.Context) (masterId string) { masterId = c.GetString("master_id") if masterId == "" { //TODO::通过域名查找masterId - //host := c.Request.Host - - //fmt.Println("not found master_id found MasterId start") - //masterId = c.GetHeader("MasterId") - //if masterId == "" && c.GetHeader("Platform") == md.PLATFORM_WAP { // H5 要根据域名去获取mid - // hostList := strings.Split(c.Request.Host, ".") - // if isNumeric(hostList[0]) { - // masterId = hostList[0] - // } else if isNumeric(hostList[1]) { - // masterId = hostList[1] - // } else { - // // 自定义域名 - // masterId = svc.GetWebSiteDomainMasterId(baseDb, md.PLATFORM_WAP, c.Request.Host) - // } - //} - //if masterId == "" && c.GetHeader("Platform") == md.PLATFORM_PC { // H5 要根据域名去获取mid - // hostList := strings.Split(c.Request.Host, ".") - // if isNumeric(hostList[0]) { - // masterId = hostList[0] - // } else if isNumeric(hostList[1]) { - // masterId = hostList[1] - // } else { - // // 自定义域名 - // masterId = svc.GetWebSiteDomainMasterId(baseDb, md.PLATFORM_PC, c.Request.Host) - // } - //} - //if masterId == "" && c.GetHeader("Platform") == "" { // 无平台访问 - // hostList := strings.Split(c.Request.Host, ".") - // if isNumeric(hostList[0]) { - // masterId = hostList[0] - // } - //} + host := c.Request.Host + mediumAppDomainDb := implement.NewMediumAppDomainDb(db.Db) + mediumAppDomain, err := mediumAppDomainDb.GetMediumAppDomainByHost(host) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err) + return + } + if mediumAppDomain == nil { + e.OutErr(c, e.ERR_NOT_FAN, "域名不存在") + return + } + masterId = utils.IntToStr(mediumAppDomain.Uuid) + c.Set("master_id", masterId) } fmt.Println("master_id:::::::", masterId) return diff --git a/go.mod b/go.mod index e5d313d..ccee961 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 //replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models require ( - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240816151818-a491f294f782 + code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240817100708-dde162209cee github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/boombuler/barcode v1.0.1 diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml index 2898b98..26fa797 100644 --- a/k8s/ingress.yaml +++ b/k8s/ingress.yaml @@ -7,7 +7,7 @@ metadata: kubesphere.io/creator: dengbiao spec: rules: - - host: 123456.medium.dengbiao.top # 使用的域名 + - host: 123456.medium.advertisement.dengbiao.top # 使用的域名 http: paths: - path: /