1234567891011121314151617181920 |
- package middlewares
- import (
- "bigdata_archives/app/e"
- "bigdata_archives/utils"
- "github.com/gin-gonic/gin"
- )
- func AdminMiddleware() gin.HandlerFunc {
- return func(c *gin.Context) {
- header := c.GetHeader("Authorization")
- _, recode := utils.ParseToken(header)
- if recode != e.SUCCESS {
- e.ResponseWithMsg(c, recode, recode.GetMsg())
- c.Abort()
- } else {
- c.Next()
- }
- }
- }
|