router.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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://web.me/
  6. // @License Apache 2.0
  7. // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
  8. package routers
  9. import (
  10. "hongze/hongze_ETA_mobile_api/controllers"
  11. "hongze/hongze_ETA_mobile_api/controllers/data_manage"
  12. "hongze/hongze_ETA_mobile_api/controllers/data_manage/correlation"
  13. "hongze/hongze_ETA_mobile_api/controllers/data_manage/future_good"
  14. "hongze/hongze_ETA_mobile_api/controllers/data_manage/line_equation"
  15. "hongze/hongze_ETA_mobile_api/controllers/english_report"
  16. "hongze/hongze_ETA_mobile_api/controllers/sandbox"
  17. "github.com/beego/beego/v2/server/web"
  18. "github.com/beego/beego/v2/server/web/filter/cors"
  19. )
  20. func init() {
  21. //解决跨域问题
  22. web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
  23. AllowAllOrigins: true,
  24. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  25. AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  26. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  27. AllowCredentials: true,
  28. }))
  29. ns := web.NewNamespace("/v1",
  30. web.NSNamespace("/sysuser",
  31. web.NSInclude(
  32. &controllers.SysUserController{},
  33. ),
  34. web.NSInclude(
  35. &controllers.SysUserAuthController{},
  36. ),
  37. ),
  38. web.NSNamespace("/ppt",
  39. web.NSInclude(
  40. &controllers.PptController{},
  41. ),
  42. web.NSInclude(
  43. &controllers.PptCommonController{},
  44. ),
  45. ),
  46. web.NSNamespace("/pptv2",
  47. web.NSInclude(
  48. &controllers.PptV2Controller{},
  49. &controllers.PptV2GroupController{},
  50. ),
  51. web.NSInclude(
  52. &controllers.PptV2CommonController{},
  53. ),
  54. ),
  55. web.NSNamespace("/ppt_english",
  56. web.NSInclude(
  57. &controllers.PptEnglishController{},
  58. &controllers.PptEnglishGroupController{},
  59. ),
  60. web.NSInclude(
  61. &controllers.PptEnglishCommonController{},
  62. ),
  63. ),
  64. web.NSNamespace("/datamanage",
  65. web.NSInclude(
  66. &data_manage.EdbInfoController{},
  67. &data_manage.ChartInfoController{},
  68. &data_manage.ExcelInfoController{},
  69. &data_manage.ChartClassifyController{},
  70. ),
  71. ),
  72. web.NSNamespace("/resource",
  73. web.NSInclude(
  74. &controllers.ResourceController{},
  75. ),
  76. ),
  77. web.NSNamespace("/my_chart",
  78. web.NSInclude(
  79. &data_manage.MyChartController{},
  80. ),
  81. ),
  82. web.NSNamespace("/sandbox",
  83. web.NSInclude(
  84. &sandbox.SandboxController{},
  85. ),
  86. ),
  87. web.NSNamespace("/future_good",
  88. web.NSInclude(
  89. //&future_good.FutureGoodEdbInfoController{},
  90. &future_good.FutureGoodChartClassifyController{},
  91. &future_good.FutureGoodChartInfoController{},
  92. ),
  93. ),
  94. web.NSNamespace("/correlation",
  95. web.NSInclude(
  96. &correlation.CorrelationChartClassifyController{},
  97. &correlation.CorrelationChartInfoController{},
  98. ),
  99. ),
  100. web.NSNamespace("/line_equation",
  101. web.NSInclude(
  102. //&line_equation.LineEquationChartClassifyController{},
  103. &line_equation.LineEquationChartInfoController{},
  104. ),
  105. ),
  106. web.NSNamespace("/classify",
  107. web.NSInclude(
  108. &controllers.ClassifyController{},
  109. ),
  110. ),
  111. web.NSNamespace("/report",
  112. web.NSInclude(
  113. &controllers.ReportController{},
  114. ),
  115. web.NSInclude(
  116. &controllers.ReportUploadCommonController{},
  117. ),
  118. ),
  119. web.NSNamespace("/english_report",
  120. web.NSInclude(
  121. &english_report.EnglishReportController{},
  122. &english_report.EnglishReportEmailController{},
  123. ),
  124. ),
  125. web.NSNamespace("/system",
  126. web.NSInclude(
  127. &controllers.SysMenuController{},
  128. ),
  129. web.NSInclude(
  130. &controllers.SysAdminController{},
  131. ),
  132. ),
  133. web.NSNamespace("/en_permission",
  134. web.NSInclude(
  135. &english_report.EnPermissionController{},
  136. ),
  137. ),
  138. )
  139. web.AddNamespace(ns)
  140. }