智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 1 година
123456789101112131415161718192021222324
  1. package mw
  2. import (
  3. "fmt"
  4. "github.com/gin-gonic/gin"
  5. )
  6. // DB is 中间件 用来检查master_id是否有对应的数据库engine
  7. func DB(c *gin.Context) {
  8. fmt.Println(c.Request.Header)
  9. masterID := c.GetHeader("master_id")
  10. fmt.Println("master_id", masterID)
  11. if masterID == "" {
  12. fmt.Println("not found master_id found MasterId start")
  13. masterID = c.GetHeader("MasterId")
  14. fmt.Println("MasterId", masterID)
  15. // if masterID still emtpy
  16. }
  17. fmt.Println("master_id", masterID)
  18. c.Set("mid", masterID)
  19. c.Next()
  20. }