routes.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // Code generated by goctl. DO NOT EDIT.
  2. package handler
  3. import (
  4. "net/http"
  5. Contact "wechat-api/internal/handler/Contact"
  6. WechatServer "wechat-api/internal/handler/WechatServer"
  7. Wx "wechat-api/internal/handler/Wx"
  8. Wxhook "wechat-api/internal/handler/Wxhook"
  9. base "wechat-api/internal/handler/base"
  10. "wechat-api/internal/svc"
  11. "github.com/zeromicro/go-zero/rest"
  12. )
  13. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  14. server.AddRoutes(
  15. []rest.Route{
  16. {
  17. Method: http.MethodGet,
  18. Path: "/init/database",
  19. Handler: base.InitDatabaseHandler(serverCtx),
  20. },
  21. },
  22. )
  23. server.AddRoutes(
  24. rest.WithMiddlewares(
  25. []rest.Middleware{serverCtx.Authority},
  26. []rest.Route{
  27. {
  28. Method: http.MethodPost,
  29. Path: "/server/create",
  30. Handler: WechatServer.CreateServerHandler(serverCtx),
  31. },
  32. {
  33. Method: http.MethodPost,
  34. Path: "/server/update",
  35. Handler: WechatServer.UpdateServerHandler(serverCtx),
  36. },
  37. {
  38. Method: http.MethodPost,
  39. Path: "/server/delete",
  40. Handler: WechatServer.DeleteServerHandler(serverCtx),
  41. },
  42. {
  43. Method: http.MethodPost,
  44. Path: "/server/list",
  45. Handler: WechatServer.GetServerListHandler(serverCtx),
  46. },
  47. {
  48. Method: http.MethodPost,
  49. Path: "/server",
  50. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  51. },
  52. }...,
  53. ),
  54. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  55. )
  56. server.AddRoutes(
  57. rest.WithMiddlewares(
  58. []rest.Middleware{serverCtx.Authority},
  59. []rest.Route{
  60. {
  61. Method: http.MethodPost,
  62. Path: "/wx/create",
  63. Handler: Wx.CreateWxHandler(serverCtx),
  64. },
  65. {
  66. Method: http.MethodPost,
  67. Path: "/wx/update",
  68. Handler: Wx.UpdateWxHandler(serverCtx),
  69. },
  70. {
  71. Method: http.MethodPost,
  72. Path: "/wx/delete",
  73. Handler: Wx.DeleteWxHandler(serverCtx),
  74. },
  75. {
  76. Method: http.MethodPost,
  77. Path: "/wx/list",
  78. Handler: Wx.GetWxListHandler(serverCtx),
  79. },
  80. {
  81. Method: http.MethodPost,
  82. Path: "/wx",
  83. Handler: Wx.GetWxByIdHandler(serverCtx),
  84. },
  85. }...,
  86. ),
  87. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  88. )
  89. server.AddRoutes(
  90. rest.WithMiddlewares(
  91. []rest.Middleware{serverCtx.Authority},
  92. []rest.Route{
  93. {
  94. Method: http.MethodPost,
  95. Path: "/wxhook/refreshLoginQR",
  96. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  97. },
  98. {
  99. Method: http.MethodPost,
  100. Path: "/wxhook/logout",
  101. Handler: Wxhook.LogoutHandler(serverCtx),
  102. },
  103. {
  104. Method: http.MethodPost,
  105. Path: "/wxhook/getFriendsAndGroups",
  106. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  107. },
  108. }...,
  109. ),
  110. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  111. )
  112. server.AddRoutes(
  113. rest.WithMiddlewares(
  114. []rest.Middleware{serverCtx.Authority},
  115. []rest.Route{
  116. {
  117. Method: http.MethodPost,
  118. Path: "/contact/create",
  119. Handler: Contact.CreateContactHandler(serverCtx),
  120. },
  121. {
  122. Method: http.MethodPost,
  123. Path: "/contact/update",
  124. Handler: Contact.UpdateContactHandler(serverCtx),
  125. },
  126. {
  127. Method: http.MethodPost,
  128. Path: "/contact/delete",
  129. Handler: Contact.DeleteContactHandler(serverCtx),
  130. },
  131. {
  132. Method: http.MethodPost,
  133. Path: "/contact/list",
  134. Handler: Contact.GetContactListHandler(serverCtx),
  135. },
  136. {
  137. Method: http.MethodPost,
  138. Path: "/contact",
  139. Handler: Contact.GetContactByIdHandler(serverCtx),
  140. },
  141. }...,
  142. ),
  143. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  144. )
  145. }