|
- 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"
- )
-
- func GetMasterId(c *gin.Context) (masterId string) {
- masterId = c.GetHeader("master_id")
- if masterId != "" {
- return
- }
-
- masterId = c.GetString("master_id")
- if masterId == "" {
- //TODO::通过域名查找masterId
- 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
- }
-
- func isNumeric(str string) bool {
- _, err := strconv.ParseFloat(str, 64)
- return err == nil
- }
|