refactor🎨: 开放接口无需认证

This commit is contained in:
wenjianzhang committed 2021-06-11 17:30:17 +08:00
1 parent 7b6e57b8dd
commit cc0dab3cd0
5 files changed
+21 -12

No files matched your search

+3 -4
View File
@@ -3,7 +3,6 @@ package middleware
import (
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
func DemoEvn() gin.HandlerFunc {
@@ -11,8 +10,8 @@ func DemoEvn() gin.HandlerFunc {
method := c.Request.Method
if method == "GET" ||
method == "OPTIONS" ||
strings.Contains(c.Request.RequestURI, "/login") ||
strings.Contains(c.Request.RequestURI, "/logout") {
c.Request.RequestURI == "/api/v1/login" ||
c.Request.RequestURI == "/api/v1/logout" {
c.Next()
} else {
c.JSON(http.StatusOK, gin.H{
@@ -24,4 +23,4 @@ func DemoEvn() gin.HandlerFunc {
}
}
}
}