|
- 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
- userAppDomainDb := implement.NewUserAppDomainDb(db.Db)
- userAppDomain, err := userAppDomainDb.GetAppDomainByHost(host)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err)
- return
- }
- if userAppDomain == nil {
- e.OutErr(c, e.ERR_NOT_FAN, "域名不存在")
- return
- }
- masterId = utils.IntToStr(userAppDomain.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
- }
|