scrm-go

router.go 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package routers
  2. import (
  3. "SCRM/controllers/admin_user"
  4. "SCRM/controllers/article"
  5. "SCRM/controllers/global"
  6. "SCRM/controllers/kefu"
  7. "SCRM/controllers/login"
  8. "SCRM/controllers/marketing_tool"
  9. "SCRM/controllers/members"
  10. "SCRM/controllers/mpwechat"
  11. "SCRM/controllers/role"
  12. "SCRM/controllers/sms"
  13. "SCRM/controllers/staff"
  14. "github.com/astaxie/beego"
  15. "github.com/astaxie/beego/plugins/cors"
  16. "SCRM/controllers/site"
  17. "SCRM/controllers/micro"
  18. "github.com/astaxie/beego/context"
  19. "SCRM/controllers/register"
  20. )
  21. func init() {
  22. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  23. AllowOrigins: []string{"http://jk.kuyicloud.com", "http://localhost:8090","http://localhost:8091", "http://test1.sgjyun.com", "https://www.ucpaas.com","http://microweb.kuyicloud.com","http://jk.test.sgjyun.com"},
  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. beego.Get("/MP_verify_JiWyx0d2U4nzjGX5.txt", func(ctx *context.Context) {
  30. ctx.Output.Body([]byte("JiWyx0d2U4nzjGX5"))
  31. })
  32. global.RegisterRouters()
  33. admin_user.RegisterRouters()
  34. login.RegisterRouters()
  35. role.RegisterRouters()
  36. members.RegisterRouters()
  37. marketing_tool.RegisterRouters()
  38. article.RegisterRouters()
  39. mpwechat.RegisterRouters()
  40. sms.RegisterRouters()
  41. staff.RegisterRouters()
  42. kefu.RegisterRouters()
  43. site.RegisterRouters()
  44. micro.RegisterRouters()
  45. register.RegisterRouter()
  46. }