routes.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. // Code generated by goctl. DO NOT EDIT.
  2. package handler
  3. import (
  4. "net/http"
  5. Message "wechat-api/internal/handler/Message"
  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. contact "wechat-api/internal/handler/contact"
  11. label "wechat-api/internal/handler/label"
  12. label_relationship "wechat-api/internal/handler/label_relationship"
  13. "wechat-api/internal/svc"
  14. "github.com/zeromicro/go-zero/rest"
  15. )
  16. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  17. server.AddRoutes(
  18. []rest.Route{
  19. {
  20. Method: http.MethodGet,
  21. Path: "/init/database",
  22. Handler: base.InitDatabaseHandler(serverCtx),
  23. },
  24. },
  25. )
  26. server.AddRoutes(
  27. rest.WithMiddlewares(
  28. []rest.Middleware{serverCtx.Authority},
  29. []rest.Route{
  30. {
  31. Method: http.MethodPost,
  32. Path: "/server/create",
  33. Handler: WechatServer.CreateServerHandler(serverCtx),
  34. },
  35. {
  36. Method: http.MethodPost,
  37. Path: "/server/update",
  38. Handler: WechatServer.UpdateServerHandler(serverCtx),
  39. },
  40. {
  41. Method: http.MethodPost,
  42. Path: "/server/delete",
  43. Handler: WechatServer.DeleteServerHandler(serverCtx),
  44. },
  45. {
  46. Method: http.MethodPost,
  47. Path: "/server/list",
  48. Handler: WechatServer.GetServerListHandler(serverCtx),
  49. },
  50. {
  51. Method: http.MethodPost,
  52. Path: "/server",
  53. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  54. },
  55. }...,
  56. ),
  57. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  58. )
  59. server.AddRoutes(
  60. rest.WithMiddlewares(
  61. []rest.Middleware{serverCtx.Authority},
  62. []rest.Route{
  63. {
  64. Method: http.MethodPost,
  65. Path: "/wx/create",
  66. Handler: Wx.CreateWxHandler(serverCtx),
  67. },
  68. {
  69. Method: http.MethodPost,
  70. Path: "/wx/update",
  71. Handler: Wx.UpdateWxHandler(serverCtx),
  72. },
  73. {
  74. Method: http.MethodPost,
  75. Path: "/wx/delete",
  76. Handler: Wx.DeleteWxHandler(serverCtx),
  77. },
  78. {
  79. Method: http.MethodPost,
  80. Path: "/wx/list",
  81. Handler: Wx.GetWxListHandler(serverCtx),
  82. },
  83. {
  84. Method: http.MethodPost,
  85. Path: "/wx",
  86. Handler: Wx.GetWxByIdHandler(serverCtx),
  87. },
  88. }...,
  89. ),
  90. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  91. )
  92. server.AddRoutes(
  93. rest.WithMiddlewares(
  94. []rest.Middleware{serverCtx.Authority},
  95. []rest.Route{
  96. {
  97. Method: http.MethodPost,
  98. Path: "/wxhook/refreshLoginQR",
  99. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  100. },
  101. {
  102. Method: http.MethodPost,
  103. Path: "/wxhook/logout",
  104. Handler: Wxhook.LogoutHandler(serverCtx),
  105. },
  106. {
  107. Method: http.MethodPost,
  108. Path: "/wxhook/getFriendsAndGroups",
  109. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  110. },
  111. {
  112. Method: http.MethodPost,
  113. Path: "/wxhook/sendTextMsg",
  114. Handler: Wxhook.SendTextMsgHandler(serverCtx),
  115. },
  116. {
  117. Method: http.MethodPost,
  118. Path: "/wxhook/sendPicMsg",
  119. Handler: Wxhook.SendPicMsgHandler(serverCtx),
  120. },
  121. {
  122. Method: http.MethodPost,
  123. Path: "/wxhook/sendPicMsgLocal",
  124. Handler: Wxhook.SendPicMsgLocalHandler(serverCtx),
  125. },
  126. }...,
  127. ),
  128. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  129. )
  130. server.AddRoutes(
  131. rest.WithMiddlewares(
  132. []rest.Middleware{serverCtx.Authority},
  133. []rest.Route{
  134. {
  135. Method: http.MethodPost,
  136. Path: "/contact/create",
  137. Handler: contact.CreateContactHandler(serverCtx),
  138. },
  139. {
  140. Method: http.MethodPost,
  141. Path: "/contact/update",
  142. Handler: contact.UpdateContactHandler(serverCtx),
  143. },
  144. {
  145. Method: http.MethodPost,
  146. Path: "/contact/delete",
  147. Handler: contact.DeleteContactHandler(serverCtx),
  148. },
  149. {
  150. Method: http.MethodPost,
  151. Path: "/contact/list",
  152. Handler: contact.GetContactListHandler(serverCtx),
  153. },
  154. {
  155. Method: http.MethodPost,
  156. Path: "/contact",
  157. Handler: contact.GetContactByIdHandler(serverCtx),
  158. },
  159. }...,
  160. ),
  161. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  162. )
  163. server.AddRoutes(
  164. rest.WithMiddlewares(
  165. []rest.Middleware{serverCtx.Authority},
  166. []rest.Route{
  167. {
  168. Method: http.MethodPost,
  169. Path: "/label_relationship/create",
  170. Handler: label_relationship.CreateLabelRelationshipHandler(serverCtx),
  171. },
  172. {
  173. Method: http.MethodPost,
  174. Path: "/label_relationship/update",
  175. Handler: label_relationship.UpdateLabelRelationshipHandler(serverCtx),
  176. },
  177. {
  178. Method: http.MethodPost,
  179. Path: "/label_relationship/update_contact_labels",
  180. Handler: label_relationship.UpdateLabelRelationshipsHandler(serverCtx),
  181. },
  182. {
  183. Method: http.MethodPost,
  184. Path: "/label_relationship/delete",
  185. Handler: label_relationship.DeleteLabelRelationshipHandler(serverCtx),
  186. },
  187. {
  188. Method: http.MethodPost,
  189. Path: "/label_relationship/list",
  190. Handler: label_relationship.GetLabelRelationshipListHandler(serverCtx),
  191. },
  192. {
  193. Method: http.MethodPost,
  194. Path: "/label_relationship",
  195. Handler: label_relationship.GetLabelRelationshipByIdHandler(serverCtx),
  196. },
  197. }...,
  198. ),
  199. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  200. )
  201. server.AddRoutes(
  202. rest.WithMiddlewares(
  203. []rest.Middleware{serverCtx.Authority},
  204. []rest.Route{
  205. {
  206. Method: http.MethodPost,
  207. Path: "/message/create",
  208. Handler: Message.CreateMessageHandler(serverCtx),
  209. },
  210. {
  211. Method: http.MethodPost,
  212. Path: "/message/update",
  213. Handler: Message.UpdateMessageHandler(serverCtx),
  214. },
  215. {
  216. Method: http.MethodPost,
  217. Path: "/message/delete",
  218. Handler: Message.DeleteMessageHandler(serverCtx),
  219. },
  220. {
  221. Method: http.MethodPost,
  222. Path: "/message/list",
  223. Handler: Message.GetMessageListHandler(serverCtx),
  224. },
  225. {
  226. Method: http.MethodPost,
  227. Path: "/message",
  228. Handler: Message.GetMessageByIdHandler(serverCtx),
  229. },
  230. }...,
  231. ),
  232. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  233. )
  234. server.AddRoutes(
  235. rest.WithMiddlewares(
  236. []rest.Middleware{serverCtx.Authority},
  237. []rest.Route{
  238. {
  239. Method: http.MethodPost,
  240. Path: "/label/create",
  241. Handler: label.CreateLabelHandler(serverCtx),
  242. },
  243. {
  244. Method: http.MethodPost,
  245. Path: "/label/update",
  246. Handler: label.UpdateLabelHandler(serverCtx),
  247. },
  248. {
  249. Method: http.MethodPost,
  250. Path: "/label/delete",
  251. Handler: label.DeleteLabelHandler(serverCtx),
  252. },
  253. {
  254. Method: http.MethodPost,
  255. Path: "/label/list",
  256. Handler: label.GetLabelListHandler(serverCtx),
  257. },
  258. {
  259. Method: http.MethodPost,
  260. Path: "/label/select_list",
  261. Handler: label.GetLabelSelectListHandler(serverCtx),
  262. },
  263. {
  264. Method: http.MethodPost,
  265. Path: "/label/contacts",
  266. Handler: label.GetLabelContactsHandler(serverCtx),
  267. },
  268. {
  269. Method: http.MethodPost,
  270. Path: "/label",
  271. Handler: label.GetLabelByIdHandler(serverCtx),
  272. },
  273. }...,
  274. ),
  275. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  276. )
  277. }