feat:完善项目
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/serve/logger"
|
||||
"context"
|
||||
"net/http"
|
||||
@ -96,19 +95,3 @@ func RecoveryHandler() gin.HandlerFunc {
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// ContentAnalysisHandler 消息体解析
|
||||
func ContentAnalysisHandler() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
url := c.Request.URL
|
||||
|
||||
var data string
|
||||
|
||||
value, has := config.SystemConfig[url.String()]
|
||||
|
||||
if has {
|
||||
data = value.(string)
|
||||
}
|
||||
c.Set(config.ContentForTenantID, data)
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +37,15 @@ func (this *Router) Init() *gin.Engine {
|
||||
if this.IsCors {
|
||||
app.Use(Cors())
|
||||
}
|
||||
app.NoRoute(NoRouteHandler())
|
||||
app.LoadHTMLFiles("./dist/*") // 添加资源路径
|
||||
app.StaticFS("/static", http.Dir("./dist/static"))
|
||||
app.StaticFile("/", "dist/index.html") //前端接口
|
||||
|
||||
//app.NoRoute(NoRouteHandler())
|
||||
app.NoMethod(NoMethodHandler())
|
||||
app.Use(LoggerHandle("log/gin.log", 3))
|
||||
app.Use(TimeoutHandle(time.Second * 30))
|
||||
//app.Use(RecoveryHandler())
|
||||
app.Use(ContentAnalysisHandler())
|
||||
|
||||
if this.RateLimitConfig != nil {
|
||||
if this.RateLimitConfig.IsRate {
|
||||
|
Reference in New Issue
Block a user