超级token

This commit is contained in:
junleea 2025-03-05 19:45:33 +08:00
parent 0ebc447c32
commit 2042c11b40
1 changed files with 7 additions and 10 deletions

17
main.go
View File

@ -137,20 +137,17 @@ func JWTAuthMiddleware() gin.HandlerFunc {
//查看token是否在超级token中 //查看token是否在超级token中
if worker.IsContainSet("super_permission_tokens", tokenString) { if worker.IsContainSet("super_permission_tokens", tokenString) {
sId := c.Request.Header.Get("super_id") sId := c.Request.Header.Get("super_id")
//if sId == "" {
// c.AbortWithStatus(200)
// c.JSON(200, gin.H{
// "message": "NOT_LOGIN",
// "error": "super_id is empty",
// "code": proto.TokenIsNull,
// })
// return
//}
if sId == "" { if sId == "" {
sId = c.Query("super_id") sId = c.Query("super_id")
} }
if sId == "" { if sId == "" {
sId = "1" c.AbortWithStatus(200)
c.JSON(200, gin.H{
"message": "NOT_LOGIN",
"error": "super_id is empty",
"code": proto.TokenIsNull,
})
return
} }
log.Printf("req super_id:%s", sId) log.Printf("req super_id:%s", sId)
id, _ := strconv.Atoi(sId) id, _ := strconv.Atoi(sId)