瀏覽代碼

update

master
dengbiao 3 週之前
父節點
當前提交
310ea699da
共有 1 個文件被更改,包括 11 次插入5 次删除
  1. +11
    -5
      app/router/router.go

+ 11
- 5
app/router/router.go 查看文件

@@ -5,6 +5,7 @@ import (
"applet/app/hdl"
"applet/app/mw"
_ "applet/docs"
"fmt"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
@@ -32,13 +33,18 @@ func Init() *gin.Engine {
r.GET("/api/open/swagger/*any", gin.BasicAuth(gin.Accounts{
"jihuoniao": "123123",
}), func(c *gin.Context) {
//requestTls := "http://"
//if c.Request.TLS != nil {
// requestTls = "https://"
//}
requestTls := "http://"
if c.Request.TLS != nil {
requestTls = "https://"
}
r.Use(mw.SwagAuth())
r.Use(cors.Default())
ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL("http://584267.adcms.zhiyingos.cn/api/api-docs/open.json"))(c)
fmt.Println(requestTls + c.GetHeader("Real-Host") + "/api/api-docs/open.json")
if c.GetHeader("Real-Host") != "" {
ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL(requestTls+c.GetHeader("Real-Host")+"/api/api-docs/open.json"))(c)
} else {
ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL(requestTls+c.Request.Host+"/api/api-docs/open.json"))(c)
}
})
r.Use(mw.ChangeHeader)



Loading…
取消
儲存