fix🐛: demo中间件添加环境判断
This commit is contained in:
1 parent
c8b27492eb
commit
7d7d8484d4
1 file changed
+15
-13
+15
-13
@@ -8,19 +8,21 @@ import (
|
|||||||
func DemoEvn() gin.HandlerFunc {
|
func DemoEvn() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
method := c.Request.Method
|
method := c.Request.Method
|
||||||
if method == "GET" ||
|
if config.ApplicationConfig.Mode == "demo" {
|
||||||
method == "OPTIONS" ||
|
if method == "GET" ||
|
||||||
c.Request.RequestURI == "/api/v1/login" ||
|
method == "OPTIONS" ||
|
||||||
c.Request.RequestURI == "/api/v1/logout" {
|
c.Request.RequestURI == "/api/v1/login" ||
|
||||||
c.Next()
|
c.Request.RequestURI == "/api/v1/logout" {
|
||||||
} else {
|
c.Next()
|
||||||
c.JSON(http.StatusOK, gin.H{
|
} else {
|
||||||
"code": 500,
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"msg": "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!\U0001F600\U0001F600\U0001F600",
|
"code": 500,
|
||||||
})
|
"msg": "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!\U0001F600\U0001F600\U0001F600",
|
||||||
c.Abort()
|
})
|
||||||
return
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
c.Next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user