|
@@ -1,6 +1,10 @@ |
|
|
package svc |
|
|
package svc |
|
|
|
|
|
|
|
|
import ( |
|
|
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" |
|
|
"fmt" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
"strconv" |
|
|
"strconv" |
|
@@ -15,38 +19,19 @@ func GetMasterId(c *gin.Context) (masterId string) { |
|
|
masterId = c.GetString("master_id") |
|
|
masterId = c.GetString("master_id") |
|
|
if masterId == "" { |
|
|
if masterId == "" { |
|
|
//TODO::通过域名查找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) |
|
|
fmt.Println("master_id:::::::", masterId) |
|
|
return |
|
|
return |
|
|