dengbiao 2 miesięcy temu
rodzic
commit
2982cf16dd
3 zmienionych plików z 19 dodań i 34 usunięć
  1. +17
    -32
      app/svc/svc_master.go
  2. +1
    -1
      go.mod
  3. +1
    -1
      k8s/ingress.yaml

+ 17
- 32
app/svc/svc_master.go Wyświetl plik

@@ -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


+ 1
- 1
go.mod Wyświetl plik

@@ -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


+ 1
- 1
k8s/ingress.yaml Wyświetl plik

@@ -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: /


Ładowanie…
Anuluj
Zapisz