Compare commits

..

2 Commits

Author SHA1 Message Date
junleea 008cbc653a Merge branch 'refs/heads/feat-user-center' 2025-06-03 13:44:39 +08:00
junleea ab2f5fd1b7 修改拦截请求 2025-06-03 13:44:32 +08:00
1 changed files with 9 additions and 5 deletions

14
main.go
View File

@ -106,11 +106,15 @@ func JWTAuthMiddleware() gin.HandlerFunc {
tokenString = c.Query("token") tokenString = c.Query("token")
} }
//如果请求为login或register则不需要验证token //如果请求为login或register则不需要验证token
for k, _ := range proto.Url_map { //for k, _ := range proto.Url_map {
if strings.Contains(c.Request.URL.Path, k) { // if strings.Contains(c.Request.URL.Path, k) {
c.Next() // c.Next()
return // return
} // }
//}
if proto.Url_map[c.Request.URL.Path] == true { //查看是否在不需要token的url中
c.Next()
return
} }
if tokenString == "" { if tokenString == "" {
//c.AbortWithStatus(200) //c.AbortWithStatus(200)