Bladeren bron

update 数据库中间件

master
dengbiao 8 maanden geleden
bovenliggende
commit
4bce8ec51d
2 gewijzigde bestanden met toevoegingen van 12 en 0 verwijderingen
  1. +1
    -0
      rule/mw/md/platform.go
  2. +11
    -0
      rule/mw/mw_db.go

+ 1
- 0
rule/mw/md/platform.go Bestand weergeven

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

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


Laden…
Annuleren
Opslaan