Compare commits

..

No commits in common. "008cbc653a0f831e53a6a34ef86557ff022d0de2" and "196887fa8beeb76e2a0cf45d9b7a502bbbebb8b7" have entirely different histories.

1 changed files with 5 additions and 9 deletions

10
main.go
View File

@ -106,16 +106,12 @@ 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()
// return
// }
//}
if proto.Url_map[c.Request.URL.Path] == true { //查看是否在不需要token的url中
c.Next() c.Next()
return return
} }
}
if tokenString == "" { if tokenString == "" {
//c.AbortWithStatus(200) //c.AbortWithStatus(200)
c.JSON(200, gin.H{ c.JSON(200, gin.H{