123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- // @APIVersion 1.0.0
- // @Title beego Test API
- // @Description beego has a very cool tools to autogenerate documents for your API
- // @Contact astaxie@gmail.com
- // @TermsOfServiceUrl http://beego.me/
- // @License Apache 2.0
- // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
- package routers
- import (
- "eta/eta_hub/controllers"
- "github.com/beego/beego/v2/server/web"
- "github.com/beego/beego/v2/server/web/filter/cors"
- )
- func init() {
- //解决跨域问题
- web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
- AllowHeaders: []string{"Origin", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "nonce", "timestamp", "appid", "signature"},
- ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
- AllowCredentials: true,
- }))
- var ns = web.NewNamespace("/v1",
- web.NSNamespace("/report",
- web.NSInclude(
- &controllers.ReportController{},
- ),
- ),
- web.NSNamespace("/english_report",
- web.NSInclude(
- &controllers.EnglishReportController{},
- ),
- ),
- web.NSNamespace("/smart_report",
- web.NSInclude(
- &controllers.SmartReportController{},
- ),
- ),
- web.NSNamespace("/edb",
- web.NSInclude(
- &controllers.EdbController{},
- ),
- ),
- web.NSNamespace("/chart",
- web.NSInclude(
- &controllers.ChartController{},
- ),
- ),
- web.NSNamespace("/statistic_analysis",
- web.NSInclude(
- &controllers.StatisticAnalysisController{},
- ),
- ),
- web.NSNamespace("/supply_analysis",
- web.NSInclude(
- &controllers.SupplyAnalysisController{},
- ),
- ),
- web.NSNamespace("/datamanage",
- web.NSInclude(
- &controllers.EdbInfoController{},
- ),
- ),
- web.NSNamespace("/entry",
- web.NSInclude(
- &controllers.TradeCommonController{},
- ),
- ),
- web.NSNamespace("/admin",
- web.NSInclude(
- &controllers.SysAdminController{},
- ),
- ),
- web.NSNamespace("/document_manage",
- web.NSInclude(
- &controllers.OutsideReportController{},
- ),
- ),
- web.NSNamespace("/resource_deal_with",
- web.NSInclude(
- &controllers.ResourceDealWithController{},
- ),
- ),
- web.NSNamespace("/sandbox",
- web.NSInclude(
- &controllers.SandboxController{},
- ),
- ),
- )
- web.AddNamespace(ns)
- }
|