From ab2f5fd1b76d667a2cb95bd14742beeaa79b568f Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Tue, 3 Jun 2025 13:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=A6=E6=88=AA=E8=AF=B7?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index faec90f..f2e2886 100644 --- a/main.go +++ b/main.go @@ -106,11 +106,15 @@ func JWTAuthMiddleware() gin.HandlerFunc { tokenString = c.Query("token") } //如果请求为login或register,则不需要验证token - for k, _ := range proto.Url_map { - if strings.Contains(c.Request.URL.Path, k) { - c.Next() - return - } + //for k, _ := range proto.Url_map { + // if strings.Contains(c.Request.URL.Path, k) { + // c.Next() + // return + // } + //} + if proto.Url_map[c.Request.URL.Path] == true { //查看是否在不需要token的url中 + c.Next() + return } if tokenString == "" { //c.AbortWithStatus(200)