router.go 4.3 KB

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