router.go 4.1 KB

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