Browse Source

update 数据库中间件

master
dengbiao 8 months ago
parent
commit
4bce8ec51d
2 changed files with 12 additions and 0 deletions
  1. +1
    -0
      rule/mw/md/platform.go
  2. +11
    -0
      rule/mw/mw_db.go

+ 1
- 0
rule/mw/md/platform.go View File

@@ -11,6 +11,7 @@ const (
PLATFORM_ANDROID = "android"
PLATFORM_IOS = "ios"
PLATFORM_JSAPI = "jsapi" // 公众号
PLATFORM_PC = "pc"
)

const WX_PAY_BROWSER = "wx_pay_browser" // 用于判断显示支付方式


+ 11
- 0
rule/mw/mw_db.go View File

@@ -27,6 +27,17 @@ func GetMasterId(baseDb *xorm.Engine, c *gin.Context) (masterId string) {
masterId = svc.GetWebSiteDomainMasterId(baseDb, md.PLATFORM_WAP, c.Request.Host)
}
}
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_PC, c.Request.Host)
}
}
}
fmt.Println("master_id:::::::", masterId)
return


Loading…
Cancel
Save