router.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // @APIVersion 1.0.0
  2. // @Title beego Test API
  3. // @Description beego has a very cool tools to autogenerate documents for your API
  4. // @Contact astaxie@gmail.com
  5. // @TermsOfServiceUrl http://beego.me/
  6. // @License Apache 2.0
  7. // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
  8. package routers
  9. import (
  10. "github.com/beego/beego/v2/server/web"
  11. "github.com/beego/beego/v2/server/web/filter/cors"
  12. "hongze/hongze_web_mfyx/controllers"
  13. )
  14. func init() {
  15. web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
  16. AllowAllOrigins: true,
  17. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  18. AllowHeaders: []string{"Origin", "Account", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "From"},
  19. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "Sign"},
  20. AllowCredentials: true,
  21. }))
  22. ns := web.NewNamespace("/api",
  23. web.NSNamespace("/wechat",
  24. web.NSInclude(
  25. &controllers.WechatController{},
  26. &controllers.WechatCommonController{},
  27. &controllers.MobileWechatController{},
  28. ),
  29. ),
  30. web.NSNamespace("/user",
  31. web.NSInclude(
  32. &controllers.UserController{},
  33. &controllers.UserCommonController{},
  34. ),
  35. ),
  36. web.NSNamespace("/permission",
  37. web.NSInclude(
  38. &controllers.ChartPermissionController{},
  39. &controllers.ChartPermissionAuthController{},
  40. &controllers.MobileChartPermissionAuthController{},
  41. ),
  42. ),
  43. web.NSNamespace("/resource",
  44. web.NSInclude(
  45. &controllers.BaseResourceController{},
  46. ),
  47. web.NSInclude(
  48. &controllers.ResourceController{},
  49. ),
  50. ),
  51. web.NSNamespace("/home",
  52. web.NSInclude(
  53. &controllers.MobileHomeController{},
  54. ),
  55. ),
  56. web.NSNamespace("/article",
  57. web.NSInclude(
  58. &controllers.ArticleController{},
  59. &controllers.ArticleNoLoginController{},
  60. ),
  61. ),
  62. web.NSNamespace("/search",
  63. web.NSInclude(
  64. &controllers.MobileSearchController{},
  65. &controllers.BaseSearchController{},
  66. ),
  67. ),
  68. web.NSNamespace("/report",
  69. web.NSInclude(
  70. &controllers.ReportController{},
  71. &controllers.ReportCommonController{},
  72. &controllers.MobileReportController{},
  73. ),
  74. ),
  75. web.NSNamespace("/report_billboard",
  76. web.NSInclude(
  77. &controllers.ReportBillboardController{},
  78. &controllers.ReportBillboardCommonController{},
  79. &controllers.MobileReportBillboardController{},
  80. ),
  81. ),
  82. web.NSNamespace("/micro_roadshow",
  83. web.NSInclude(
  84. &controllers.MicroRoadShowController{},
  85. ),
  86. ),
  87. web.NSNamespace("/activity",
  88. web.NSInclude(
  89. &controllers.ActivityController{},
  90. &controllers.ActivityNoLoginController{},
  91. ),
  92. ),
  93. web.NSNamespace("/advice",
  94. web.NSInclude(
  95. &controllers.AdviceController{},
  96. ),
  97. ),
  98. web.NSNamespace("/research",
  99. web.NSInclude(
  100. &controllers.MobileResearchController{},
  101. ),
  102. ),
  103. web.NSNamespace("/config",
  104. web.NSInclude(
  105. &controllers.ConfigController{},
  106. &controllers.BaseConfigController{},
  107. ),
  108. ),
  109. web.NSNamespace("/banner",
  110. web.NSInclude(
  111. &controllers.BannerController{},
  112. &controllers.BaseBannerController{},
  113. ),
  114. ),
  115. web.NSNamespace("/tag",
  116. web.NSInclude(
  117. &controllers.TagController{},
  118. &controllers.BaseTagController{},
  119. ),
  120. ),
  121. web.NSNamespace("/collection",
  122. web.NSInclude(
  123. &controllers.CollectionController{},
  124. &controllers.BaseCollectionController{},
  125. ),
  126. ),
  127. web.NSNamespace("/yanxuan_special",
  128. web.NSInclude(
  129. &controllers.YanxuanSpecialController{},
  130. &controllers.YanxuanSpecialNoLoginController{},
  131. &controllers.YanxuanSpecialMessageController{},
  132. ),
  133. ),
  134. web.NSNamespace("/order",
  135. web.NSInclude(
  136. &controllers.OrderController{},
  137. ),
  138. ),
  139. )
  140. web.AddNamespace(ns)
  141. }