|
12345678910111213141516171819202122232425 |
- package mw
-
- import (
- "github.com/gin-gonic/gin"
- )
-
- // DB is 中间件 用来检查master_id是否有对应的数据库engine
- func DB(c *gin.Context) {
- //fmt.Println(c.Request.Header)
- //masterID := svc.GetMasterId(c)
- //fmt.Println("master_id", masterID)
- //if masterID == "" {
- // e.OutErr(c, e.ERR_MASTER_ID, errors.New("not found master_id"))
- // return
- //}
- //
- //_, ok := db.DBs[masterID]
- //if !ok {
- // e.OutErr(c, e.ERR_MASTER_ID, errors.New("not found master_id in DBs"))
- // return
- //}
- //fmt.Println("master_id", masterID)
- //c.Set("mid", masterID)
- c.Next()
- }
|