router.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package routers
  2. import (
  3. "eta/eta_mini_crm_ht/controllers"
  4. beego "github.com/beego/beego/v2/server/web"
  5. "github.com/beego/beego/v2/server/web/filter/cors"
  6. )
  7. func init() {
  8. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  9. AllowAllOrigins: true,
  10. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  11. AllowHeaders: []string{"Origin", "Authorization", "Uuid", "Accesstoken", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  12. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  13. AllowCredentials: true,
  14. }))
  15. ns := beego.NewNamespace("/adminapi",
  16. beego.NSNamespace("/sys_user",
  17. beego.NSInclude(
  18. &controllers.UserLoginController{},
  19. &controllers.SysUserController{},
  20. ),
  21. ),
  22. beego.NSNamespace("/sys",
  23. beego.NSInclude(
  24. &controllers.SysConfigController{},
  25. ),
  26. ),
  27. beego.NSNamespace("/department",
  28. beego.NSInclude(
  29. &controllers.SysDepartmentController{},
  30. ),
  31. ),
  32. beego.NSNamespace("/order",
  33. beego.NSInclude(
  34. &controllers.OrderController{},
  35. ),
  36. ),
  37. beego.NSNamespace("/role",
  38. beego.NSInclude(
  39. &controllers.SysRoleController{},
  40. ),
  41. ),
  42. beego.NSNamespace("/chart_permission",
  43. beego.NSInclude(
  44. &controllers.ChartPermissionController{},
  45. ),
  46. ),
  47. beego.NSNamespace("/user",
  48. beego.NSInclude(
  49. &controllers.UserController{},
  50. ),
  51. ),
  52. beego.NSNamespace("/classify",
  53. beego.NSInclude(
  54. &controllers.ClassifyController{},
  55. ),
  56. ),
  57. beego.NSNamespace("/feedBack",
  58. beego.NSInclude(
  59. &controllers.FeedBackController{},
  60. ),
  61. ),
  62. beego.NSNamespace("/analyst",
  63. beego.NSInclude(
  64. &controllers.AnalystController{},
  65. ),
  66. ),
  67. beego.NSNamespace("/media",
  68. beego.NSInclude(
  69. &controllers.AudioController{},
  70. &controllers.VideoController{},
  71. ),
  72. ),
  73. beego.NSNamespace("/source",
  74. beego.NSInclude(
  75. &controllers.ImageController{},
  76. ),
  77. ),
  78. beego.NSNamespace("/message",
  79. beego.NSInclude(
  80. &controllers.MessageController{},
  81. ),
  82. ),
  83. beego.NSNamespace("/risk",
  84. beego.NSInclude(
  85. &controllers.RiskConfigController{},
  86. ),
  87. ),
  88. beego.NSNamespace("/customer",
  89. beego.NSInclude(
  90. &controllers.CustomerProductRiskMappingController{},
  91. ),
  92. ),
  93. beego.NSNamespace("/merchant",
  94. beego.NSInclude(
  95. &controllers.MerchantController{},
  96. ),
  97. ),
  98. beego.NSNamespace("/product",
  99. beego.NSInclude(
  100. &controllers.ProductController{},
  101. ),
  102. ),
  103. )
  104. beego.AddNamespace(ns)
  105. }