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