routes.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. // Code generated by goctl. DO NOT EDIT.
  2. package handler
  3. import (
  4. "net/http"
  5. ChatRoomMember "wechat-api/internal/handler/ChatRoomMember"
  6. Message "wechat-api/internal/handler/Message"
  7. WechatServer "wechat-api/internal/handler/WechatServer"
  8. Wx "wechat-api/internal/handler/Wx"
  9. Wxhook "wechat-api/internal/handler/Wxhook"
  10. base "wechat-api/internal/handler/base"
  11. contact "wechat-api/internal/handler/contact"
  12. label "wechat-api/internal/handler/label"
  13. label_relationship "wechat-api/internal/handler/label_relationship"
  14. message_records "wechat-api/internal/handler/message_records"
  15. sop_node "wechat-api/internal/handler/sop_node"
  16. sop_stage "wechat-api/internal/handler/sop_stage"
  17. sop_task "wechat-api/internal/handler/sop_task"
  18. "wechat-api/internal/svc"
  19. "github.com/zeromicro/go-zero/rest"
  20. )
  21. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  22. server.AddRoutes(
  23. []rest.Route{
  24. {
  25. Method: http.MethodGet,
  26. Path: "/init/database",
  27. Handler: base.InitDatabaseHandler(serverCtx),
  28. },
  29. },
  30. )
  31. server.AddRoutes(
  32. rest.WithMiddlewares(
  33. []rest.Middleware{serverCtx.Authority},
  34. []rest.Route{
  35. {
  36. Method: http.MethodPost,
  37. Path: "/server/create",
  38. Handler: WechatServer.CreateServerHandler(serverCtx),
  39. },
  40. {
  41. Method: http.MethodPost,
  42. Path: "/server/update",
  43. Handler: WechatServer.UpdateServerHandler(serverCtx),
  44. },
  45. {
  46. Method: http.MethodPost,
  47. Path: "/server/delete",
  48. Handler: WechatServer.DeleteServerHandler(serverCtx),
  49. },
  50. {
  51. Method: http.MethodPost,
  52. Path: "/server/list",
  53. Handler: WechatServer.GetServerListHandler(serverCtx),
  54. },
  55. {
  56. Method: http.MethodPost,
  57. Path: "/server",
  58. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  59. },
  60. }...,
  61. ),
  62. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  63. )
  64. server.AddRoutes(
  65. rest.WithMiddlewares(
  66. []rest.Middleware{serverCtx.Authority},
  67. []rest.Route{
  68. {
  69. Method: http.MethodPost,
  70. Path: "/wx/create",
  71. Handler: Wx.CreateWxHandler(serverCtx),
  72. },
  73. {
  74. Method: http.MethodPost,
  75. Path: "/wx/update",
  76. Handler: Wx.UpdateWxHandler(serverCtx),
  77. },
  78. {
  79. Method: http.MethodPost,
  80. Path: "/wx/delete",
  81. Handler: Wx.DeleteWxHandler(serverCtx),
  82. },
  83. {
  84. Method: http.MethodPost,
  85. Path: "/wx/list",
  86. Handler: Wx.GetWxListHandler(serverCtx),
  87. },
  88. {
  89. Method: http.MethodPost,
  90. Path: "/wx",
  91. Handler: Wx.GetWxByIdHandler(serverCtx),
  92. },
  93. }...,
  94. ),
  95. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  96. )
  97. server.AddRoutes(
  98. []rest.Route{
  99. {
  100. Method: http.MethodPost,
  101. Path: "/wxhook/sendTextMsg",
  102. Handler: Wxhook.SendTextMsgHandler(serverCtx),
  103. },
  104. },
  105. )
  106. server.AddRoutes(
  107. rest.WithMiddlewares(
  108. []rest.Middleware{serverCtx.Authority},
  109. []rest.Route{
  110. {
  111. Method: http.MethodPost,
  112. Path: "/wxhook/refreshLoginQR",
  113. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  114. },
  115. {
  116. Method: http.MethodPost,
  117. Path: "/wxhook/logout",
  118. Handler: Wxhook.LogoutHandler(serverCtx),
  119. },
  120. {
  121. Method: http.MethodPost,
  122. Path: "/wxhook/getFriendsAndGroups",
  123. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  124. },
  125. {
  126. Method: http.MethodPost,
  127. Path: "/wxhook/sendPicMsg",
  128. Handler: Wxhook.SendPicMsgHandler(serverCtx),
  129. },
  130. {
  131. Method: http.MethodPost,
  132. Path: "/wxhook/sendPicMsgLocal",
  133. Handler: Wxhook.SendPicMsgLocalHandler(serverCtx),
  134. },
  135. }...,
  136. ),
  137. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  138. )
  139. server.AddRoutes(
  140. rest.WithMiddlewares(
  141. []rest.Middleware{serverCtx.Authority},
  142. []rest.Route{
  143. {
  144. Method: http.MethodPost,
  145. Path: "/contact/create",
  146. Handler: contact.CreateContactHandler(serverCtx),
  147. },
  148. {
  149. Method: http.MethodPost,
  150. Path: "/contact/update",
  151. Handler: contact.UpdateContactHandler(serverCtx),
  152. },
  153. {
  154. Method: http.MethodPost,
  155. Path: "/contact/delete",
  156. Handler: contact.DeleteContactHandler(serverCtx),
  157. },
  158. {
  159. Method: http.MethodPost,
  160. Path: "/contact/list",
  161. Handler: contact.GetContactListHandler(serverCtx),
  162. },
  163. {
  164. Method: http.MethodPost,
  165. Path: "/contact",
  166. Handler: contact.GetContactByIdHandler(serverCtx),
  167. },
  168. {
  169. Method: http.MethodPost,
  170. Path: "/contact/addNewFriend",
  171. Handler: contact.AddNewFriendHandler(serverCtx),
  172. },
  173. }...,
  174. ),
  175. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  176. )
  177. server.AddRoutes(
  178. rest.WithMiddlewares(
  179. []rest.Middleware{serverCtx.Authority},
  180. []rest.Route{
  181. {
  182. Method: http.MethodPost,
  183. Path: "/label_relationship/create",
  184. Handler: label_relationship.CreateLabelRelationshipHandler(serverCtx),
  185. },
  186. {
  187. Method: http.MethodPost,
  188. Path: "/label_relationship/update",
  189. Handler: label_relationship.UpdateLabelRelationshipHandler(serverCtx),
  190. },
  191. {
  192. Method: http.MethodPost,
  193. Path: "/label_relationship/update_contact_labels",
  194. Handler: label_relationship.UpdateLabelRelationshipsHandler(serverCtx),
  195. },
  196. {
  197. Method: http.MethodPost,
  198. Path: "/label_relationship/delete",
  199. Handler: label_relationship.DeleteLabelRelationshipHandler(serverCtx),
  200. },
  201. {
  202. Method: http.MethodPost,
  203. Path: "/label_relationship/list",
  204. Handler: label_relationship.GetLabelRelationshipListHandler(serverCtx),
  205. },
  206. {
  207. Method: http.MethodPost,
  208. Path: "/label_relationship",
  209. Handler: label_relationship.GetLabelRelationshipByIdHandler(serverCtx),
  210. },
  211. }...,
  212. ),
  213. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  214. )
  215. server.AddRoutes(
  216. rest.WithMiddlewares(
  217. []rest.Middleware{serverCtx.Authority},
  218. []rest.Route{
  219. {
  220. Method: http.MethodPost,
  221. Path: "/message/create",
  222. Handler: Message.CreateMessageHandler(serverCtx),
  223. },
  224. {
  225. Method: http.MethodPost,
  226. Path: "/message/update",
  227. Handler: Message.UpdateMessageHandler(serverCtx),
  228. },
  229. {
  230. Method: http.MethodPost,
  231. Path: "/message/delete",
  232. Handler: Message.DeleteMessageHandler(serverCtx),
  233. },
  234. {
  235. Method: http.MethodPost,
  236. Path: "/message/list",
  237. Handler: Message.GetMessageListHandler(serverCtx),
  238. },
  239. {
  240. Method: http.MethodPost,
  241. Path: "/message",
  242. Handler: Message.GetMessageByIdHandler(serverCtx),
  243. },
  244. }...,
  245. ),
  246. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  247. )
  248. server.AddRoutes(
  249. rest.WithMiddlewares(
  250. []rest.Middleware{serverCtx.Authority},
  251. []rest.Route{
  252. {
  253. Method: http.MethodPost,
  254. Path: "/label/create",
  255. Handler: label.CreateLabelHandler(serverCtx),
  256. },
  257. {
  258. Method: http.MethodPost,
  259. Path: "/label/update",
  260. Handler: label.UpdateLabelHandler(serverCtx),
  261. },
  262. {
  263. Method: http.MethodPost,
  264. Path: "/label/delete",
  265. Handler: label.DeleteLabelHandler(serverCtx),
  266. },
  267. {
  268. Method: http.MethodPost,
  269. Path: "/label/list",
  270. Handler: label.GetLabelListHandler(serverCtx),
  271. },
  272. {
  273. Method: http.MethodPost,
  274. Path: "/label/select_list",
  275. Handler: label.GetLabelSelectListHandler(serverCtx),
  276. },
  277. {
  278. Method: http.MethodPost,
  279. Path: "/label/contacts",
  280. Handler: label.GetLabelContactsHandler(serverCtx),
  281. },
  282. {
  283. Method: http.MethodPost,
  284. Path: "/label",
  285. Handler: label.GetLabelByIdHandler(serverCtx),
  286. },
  287. }...,
  288. ),
  289. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  290. )
  291. server.AddRoutes(
  292. rest.WithMiddlewares(
  293. []rest.Middleware{serverCtx.Authority},
  294. []rest.Route{
  295. {
  296. Method: http.MethodPost,
  297. Path: "/sop_task/create",
  298. Handler: sop_task.CreateSopTaskHandler(serverCtx),
  299. },
  300. {
  301. Method: http.MethodPost,
  302. Path: "/sop_task/update",
  303. Handler: sop_task.UpdateSopTaskHandler(serverCtx),
  304. },
  305. {
  306. Method: http.MethodPost,
  307. Path: "/sop_task/delete",
  308. Handler: sop_task.DeleteSopTaskHandler(serverCtx),
  309. },
  310. {
  311. Method: http.MethodPost,
  312. Path: "/sop_task/list",
  313. Handler: sop_task.GetSopTaskListHandler(serverCtx),
  314. },
  315. {
  316. Method: http.MethodPost,
  317. Path: "/sop_task",
  318. Handler: sop_task.GetSopTaskByIdHandler(serverCtx),
  319. },
  320. {
  321. Method: http.MethodPost,
  322. Path: "/sop_task/detail",
  323. Handler: sop_task.GetSopTaskDetailHandler(serverCtx),
  324. },
  325. {
  326. Method: http.MethodPost,
  327. Path: "/sop_task/publish",
  328. Handler: sop_task.PublishSopTaskHandler(serverCtx),
  329. },
  330. }...,
  331. ),
  332. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  333. )
  334. server.AddRoutes(
  335. rest.WithMiddlewares(
  336. []rest.Middleware{serverCtx.Authority},
  337. []rest.Route{
  338. {
  339. Method: http.MethodPost,
  340. Path: "/sop_stage/create",
  341. Handler: sop_stage.CreateSopStageHandler(serverCtx),
  342. },
  343. {
  344. Method: http.MethodPost,
  345. Path: "/sop_stage/update",
  346. Handler: sop_stage.UpdateSopStageHandler(serverCtx),
  347. },
  348. {
  349. Method: http.MethodPost,
  350. Path: "/sop_stage/delete",
  351. Handler: sop_stage.DeleteSopStageHandler(serverCtx),
  352. },
  353. {
  354. Method: http.MethodPost,
  355. Path: "/sop_stage/list",
  356. Handler: sop_stage.GetSopStageListHandler(serverCtx),
  357. },
  358. {
  359. Method: http.MethodPost,
  360. Path: "/sop_stage",
  361. Handler: sop_stage.GetSopStageByIdHandler(serverCtx),
  362. },
  363. {
  364. Method: http.MethodPost,
  365. Path: "/sop_stage/detail",
  366. Handler: sop_stage.GetSopStageDetailHandler(serverCtx),
  367. },
  368. {
  369. Method: http.MethodPost,
  370. Path: "/sop_stage/move",
  371. Handler: sop_stage.MoveSopStageHandler(serverCtx),
  372. },
  373. }...,
  374. ),
  375. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  376. )
  377. server.AddRoutes(
  378. rest.WithMiddlewares(
  379. []rest.Middleware{serverCtx.Authority},
  380. []rest.Route{
  381. {
  382. Method: http.MethodPost,
  383. Path: "/sop_node/create",
  384. Handler: sop_node.CreateSopNodeHandler(serverCtx),
  385. },
  386. {
  387. Method: http.MethodPost,
  388. Path: "/sop_node/update",
  389. Handler: sop_node.UpdateSopNodeHandler(serverCtx),
  390. },
  391. {
  392. Method: http.MethodPost,
  393. Path: "/sop_node/delete",
  394. Handler: sop_node.DeleteSopNodeHandler(serverCtx),
  395. },
  396. {
  397. Method: http.MethodPost,
  398. Path: "/sop_node/list",
  399. Handler: sop_node.GetSopNodeListHandler(serverCtx),
  400. },
  401. {
  402. Method: http.MethodPost,
  403. Path: "/sop_node/detail",
  404. Handler: sop_node.GetSopNodeDetailHandler(serverCtx),
  405. },
  406. }...,
  407. ),
  408. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  409. )
  410. server.AddRoutes(
  411. rest.WithMiddlewares(
  412. []rest.Middleware{serverCtx.Authority},
  413. []rest.Route{
  414. {
  415. Method: http.MethodPost,
  416. Path: "/message_records/create",
  417. Handler: message_records.CreateMessageRecordsHandler(serverCtx),
  418. },
  419. {
  420. Method: http.MethodPost,
  421. Path: "/message_records/update",
  422. Handler: message_records.UpdateMessageRecordsHandler(serverCtx),
  423. },
  424. {
  425. Method: http.MethodPost,
  426. Path: "/message_records/delete",
  427. Handler: message_records.DeleteMessageRecordsHandler(serverCtx),
  428. },
  429. {
  430. Method: http.MethodPost,
  431. Path: "/message_records/list",
  432. Handler: message_records.GetMessageRecordsListHandler(serverCtx),
  433. },
  434. {
  435. Method: http.MethodPost,
  436. Path: "/message_records",
  437. Handler: message_records.GetMessageRecordsByIdHandler(serverCtx),
  438. },
  439. }...,
  440. ),
  441. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  442. )
  443. server.AddRoutes(
  444. rest.WithMiddlewares(
  445. []rest.Middleware{serverCtx.Authority},
  446. []rest.Route{
  447. {
  448. Method: http.MethodPost,
  449. Path: "/chatroom_member/list",
  450. Handler: ChatRoomMember.GetChatroomMemberListHandler(serverCtx),
  451. },
  452. }...,
  453. ),
  454. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  455. )
  456. }