routes.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. agent "wechat-api/internal/handler/agent"
  11. base "wechat-api/internal/handler/base"
  12. batch_msg "wechat-api/internal/handler/batch_msg"
  13. contact "wechat-api/internal/handler/contact"
  14. label "wechat-api/internal/handler/label"
  15. label_relationship "wechat-api/internal/handler/label_relationship"
  16. message_records "wechat-api/internal/handler/message_records"
  17. openapi "wechat-api/internal/handler/openapi"
  18. sop_node "wechat-api/internal/handler/sop_node"
  19. sop_stage "wechat-api/internal/handler/sop_stage"
  20. sop_task "wechat-api/internal/handler/sop_task"
  21. "wechat-api/internal/svc"
  22. "github.com/zeromicro/go-zero/rest"
  23. )
  24. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  25. server.AddRoutes(
  26. []rest.Route{
  27. {
  28. Method: http.MethodGet,
  29. Path: "/init/database",
  30. Handler: base.InitDatabaseHandler(serverCtx),
  31. },
  32. },
  33. )
  34. server.AddRoutes(
  35. rest.WithMiddlewares(
  36. []rest.Middleware{serverCtx.Authority},
  37. []rest.Route{
  38. {
  39. Method: http.MethodPost,
  40. Path: "/server/create",
  41. Handler: WechatServer.CreateServerHandler(serverCtx),
  42. },
  43. {
  44. Method: http.MethodPost,
  45. Path: "/server/update",
  46. Handler: WechatServer.UpdateServerHandler(serverCtx),
  47. },
  48. {
  49. Method: http.MethodPost,
  50. Path: "/server/delete",
  51. Handler: WechatServer.DeleteServerHandler(serverCtx),
  52. },
  53. {
  54. Method: http.MethodPost,
  55. Path: "/server/list",
  56. Handler: WechatServer.GetServerListHandler(serverCtx),
  57. },
  58. {
  59. Method: http.MethodPost,
  60. Path: "/server",
  61. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  62. },
  63. }...,
  64. ),
  65. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  66. )
  67. server.AddRoutes(
  68. rest.WithMiddlewares(
  69. []rest.Middleware{serverCtx.Authority},
  70. []rest.Route{
  71. {
  72. Method: http.MethodPost,
  73. Path: "/wx/create",
  74. Handler: Wx.CreateWxHandler(serverCtx),
  75. },
  76. {
  77. Method: http.MethodPost,
  78. Path: "/wx/update",
  79. Handler: Wx.UpdateWxHandler(serverCtx),
  80. },
  81. {
  82. Method: http.MethodPost,
  83. Path: "/wx/delete",
  84. Handler: Wx.DeleteWxHandler(serverCtx),
  85. },
  86. {
  87. Method: http.MethodPost,
  88. Path: "/wx/list",
  89. Handler: Wx.GetWxListHandler(serverCtx),
  90. },
  91. {
  92. Method: http.MethodPost,
  93. Path: "/wx",
  94. Handler: Wx.GetWxByIdHandler(serverCtx),
  95. },
  96. }...,
  97. ),
  98. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  99. )
  100. server.AddRoutes(
  101. []rest.Route{
  102. {
  103. Method: http.MethodPost,
  104. Path: "/wxhook/sendTextMsg",
  105. Handler: Wxhook.SendTextMsgHandler(serverCtx),
  106. },
  107. },
  108. )
  109. server.AddRoutes(
  110. rest.WithMiddlewares(
  111. []rest.Middleware{serverCtx.Authority},
  112. []rest.Route{
  113. {
  114. Method: http.MethodPost,
  115. Path: "/wxhook/refreshLoginQR",
  116. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  117. },
  118. {
  119. Method: http.MethodPost,
  120. Path: "/wxhook/logout",
  121. Handler: Wxhook.LogoutHandler(serverCtx),
  122. },
  123. {
  124. Method: http.MethodPost,
  125. Path: "/wxhook/getFriendsAndGroups",
  126. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  127. },
  128. {
  129. Method: http.MethodPost,
  130. Path: "/wxhook/sendPicMsg",
  131. Handler: Wxhook.SendPicMsgHandler(serverCtx),
  132. },
  133. {
  134. Method: http.MethodPost,
  135. Path: "/wxhook/sendPicMsgLocal",
  136. Handler: Wxhook.SendPicMsgLocalHandler(serverCtx),
  137. },
  138. }...,
  139. ),
  140. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  141. )
  142. server.AddRoutes(
  143. rest.WithMiddlewares(
  144. []rest.Middleware{serverCtx.Authority},
  145. []rest.Route{
  146. {
  147. Method: http.MethodPost,
  148. Path: "/contact/create",
  149. Handler: contact.CreateContactHandler(serverCtx),
  150. },
  151. {
  152. Method: http.MethodPost,
  153. Path: "/contact/update",
  154. Handler: contact.UpdateContactHandler(serverCtx),
  155. },
  156. {
  157. Method: http.MethodPost,
  158. Path: "/contact/delete",
  159. Handler: contact.DeleteContactHandler(serverCtx),
  160. },
  161. {
  162. Method: http.MethodPost,
  163. Path: "/contact/list",
  164. Handler: contact.GetContactListHandler(serverCtx),
  165. },
  166. {
  167. Method: http.MethodPost,
  168. Path: "/contact",
  169. Handler: contact.GetContactByIdHandler(serverCtx),
  170. },
  171. {
  172. Method: http.MethodPost,
  173. Path: "/contact/addNewFriend",
  174. Handler: contact.AddNewFriendHandler(serverCtx),
  175. },
  176. }...,
  177. ),
  178. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  179. )
  180. server.AddRoutes(
  181. rest.WithMiddlewares(
  182. []rest.Middleware{serverCtx.Authority},
  183. []rest.Route{
  184. {
  185. Method: http.MethodPost,
  186. Path: "/label_relationship/create",
  187. Handler: label_relationship.CreateLabelRelationshipHandler(serverCtx),
  188. },
  189. {
  190. Method: http.MethodPost,
  191. Path: "/label_relationship/update",
  192. Handler: label_relationship.UpdateLabelRelationshipHandler(serverCtx),
  193. },
  194. {
  195. Method: http.MethodPost,
  196. Path: "/label_relationship/update_contact_labels",
  197. Handler: label_relationship.UpdateLabelRelationshipsHandler(serverCtx),
  198. },
  199. {
  200. Method: http.MethodPost,
  201. Path: "/label_relationship/delete",
  202. Handler: label_relationship.DeleteLabelRelationshipHandler(serverCtx),
  203. },
  204. {
  205. Method: http.MethodPost,
  206. Path: "/label_relationship/list",
  207. Handler: label_relationship.GetLabelRelationshipListHandler(serverCtx),
  208. },
  209. {
  210. Method: http.MethodPost,
  211. Path: "/label_relationship",
  212. Handler: label_relationship.GetLabelRelationshipByIdHandler(serverCtx),
  213. },
  214. }...,
  215. ),
  216. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  217. )
  218. server.AddRoutes(
  219. rest.WithMiddlewares(
  220. []rest.Middleware{serverCtx.Authority},
  221. []rest.Route{
  222. {
  223. Method: http.MethodPost,
  224. Path: "/message/create",
  225. Handler: Message.CreateMessageHandler(serverCtx),
  226. },
  227. {
  228. Method: http.MethodPost,
  229. Path: "/message/update",
  230. Handler: Message.UpdateMessageHandler(serverCtx),
  231. },
  232. {
  233. Method: http.MethodPost,
  234. Path: "/message/delete",
  235. Handler: Message.DeleteMessageHandler(serverCtx),
  236. },
  237. {
  238. Method: http.MethodPost,
  239. Path: "/message/list",
  240. Handler: Message.GetMessageListHandler(serverCtx),
  241. },
  242. {
  243. Method: http.MethodPost,
  244. Path: "/message",
  245. Handler: Message.GetMessageByIdHandler(serverCtx),
  246. },
  247. }...,
  248. ),
  249. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  250. )
  251. server.AddRoutes(
  252. rest.WithMiddlewares(
  253. []rest.Middleware{serverCtx.Authority},
  254. []rest.Route{
  255. {
  256. Method: http.MethodPost,
  257. Path: "/label/create",
  258. Handler: label.CreateLabelHandler(serverCtx),
  259. },
  260. {
  261. Method: http.MethodPost,
  262. Path: "/label/update",
  263. Handler: label.UpdateLabelHandler(serverCtx),
  264. },
  265. {
  266. Method: http.MethodPost,
  267. Path: "/label/delete",
  268. Handler: label.DeleteLabelHandler(serverCtx),
  269. },
  270. {
  271. Method: http.MethodPost,
  272. Path: "/label/list",
  273. Handler: label.GetLabelListHandler(serverCtx),
  274. },
  275. {
  276. Method: http.MethodPost,
  277. Path: "/label/select_list",
  278. Handler: label.GetLabelSelectListHandler(serverCtx),
  279. },
  280. {
  281. Method: http.MethodPost,
  282. Path: "/label/contacts",
  283. Handler: label.GetLabelContactsHandler(serverCtx),
  284. },
  285. {
  286. Method: http.MethodPost,
  287. Path: "/label",
  288. Handler: label.GetLabelByIdHandler(serverCtx),
  289. },
  290. }...,
  291. ),
  292. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  293. )
  294. server.AddRoutes(
  295. rest.WithMiddlewares(
  296. []rest.Middleware{serverCtx.Authority},
  297. []rest.Route{
  298. {
  299. Method: http.MethodPost,
  300. Path: "/sop_task/create",
  301. Handler: sop_task.CreateSopTaskHandler(serverCtx),
  302. },
  303. {
  304. Method: http.MethodPost,
  305. Path: "/sop_task/update",
  306. Handler: sop_task.UpdateSopTaskHandler(serverCtx),
  307. },
  308. {
  309. Method: http.MethodPost,
  310. Path: "/sop_task/delete",
  311. Handler: sop_task.DeleteSopTaskHandler(serverCtx),
  312. },
  313. {
  314. Method: http.MethodPost,
  315. Path: "/sop_task/list",
  316. Handler: sop_task.GetSopTaskListHandler(serverCtx),
  317. },
  318. {
  319. Method: http.MethodPost,
  320. Path: "/sop_task/record_list",
  321. Handler: sop_task.GetSopTaskRecordListHandler(serverCtx),
  322. },
  323. {
  324. Method: http.MethodPost,
  325. Path: "/sop_task",
  326. Handler: sop_task.GetSopTaskByIdHandler(serverCtx),
  327. },
  328. {
  329. Method: http.MethodPost,
  330. Path: "/sop_task/detail",
  331. Handler: sop_task.GetSopTaskDetailHandler(serverCtx),
  332. },
  333. {
  334. Method: http.MethodPost,
  335. Path: "/sop_task/publish",
  336. Handler: sop_task.PublishSopTaskHandler(serverCtx),
  337. },
  338. {
  339. Method: http.MethodPost,
  340. Path: "/sop_task/start",
  341. Handler: sop_task.SopTaskStartHandler(serverCtx),
  342. },
  343. {
  344. Method: http.MethodPost,
  345. Path: "/sop_task/stop",
  346. Handler: sop_task.SopTaskStopHandler(serverCtx),
  347. },
  348. }...,
  349. ),
  350. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  351. )
  352. server.AddRoutes(
  353. rest.WithMiddlewares(
  354. []rest.Middleware{serverCtx.Authority},
  355. []rest.Route{
  356. {
  357. Method: http.MethodPost,
  358. Path: "/sop_stage/create",
  359. Handler: sop_stage.CreateSopStageHandler(serverCtx),
  360. },
  361. {
  362. Method: http.MethodPost,
  363. Path: "/sop_stage/update",
  364. Handler: sop_stage.UpdateSopStageHandler(serverCtx),
  365. },
  366. {
  367. Method: http.MethodPost,
  368. Path: "/sop_stage/delete",
  369. Handler: sop_stage.DeleteSopStageHandler(serverCtx),
  370. },
  371. {
  372. Method: http.MethodPost,
  373. Path: "/sop_stage/list",
  374. Handler: sop_stage.GetSopStageListHandler(serverCtx),
  375. },
  376. {
  377. Method: http.MethodPost,
  378. Path: "/sop_stage",
  379. Handler: sop_stage.GetSopStageByIdHandler(serverCtx),
  380. },
  381. {
  382. Method: http.MethodPost,
  383. Path: "/sop_stage/detail",
  384. Handler: sop_stage.GetSopStageDetailHandler(serverCtx),
  385. },
  386. {
  387. Method: http.MethodPost,
  388. Path: "/sop_stage/move",
  389. Handler: sop_stage.MoveSopStageHandler(serverCtx),
  390. },
  391. }...,
  392. ),
  393. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  394. )
  395. server.AddRoutes(
  396. rest.WithMiddlewares(
  397. []rest.Middleware{serverCtx.Authority},
  398. []rest.Route{
  399. {
  400. Method: http.MethodPost,
  401. Path: "/sop_node/create",
  402. Handler: sop_node.CreateSopNodeHandler(serverCtx),
  403. },
  404. {
  405. Method: http.MethodPost,
  406. Path: "/sop_node/update",
  407. Handler: sop_node.UpdateSopNodeHandler(serverCtx),
  408. },
  409. {
  410. Method: http.MethodPost,
  411. Path: "/sop_node/delete",
  412. Handler: sop_node.DeleteSopNodeHandler(serverCtx),
  413. },
  414. {
  415. Method: http.MethodPost,
  416. Path: "/sop_node/list",
  417. Handler: sop_node.GetSopNodeListHandler(serverCtx),
  418. },
  419. {
  420. Method: http.MethodPost,
  421. Path: "/sop_node/detail",
  422. Handler: sop_node.GetSopNodeDetailHandler(serverCtx),
  423. },
  424. }...,
  425. ),
  426. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  427. )
  428. server.AddRoutes(
  429. rest.WithMiddlewares(
  430. []rest.Middleware{serverCtx.Authority},
  431. []rest.Route{
  432. {
  433. Method: http.MethodPost,
  434. Path: "/message_records/create",
  435. Handler: message_records.CreateMessageRecordsHandler(serverCtx),
  436. },
  437. {
  438. Method: http.MethodPost,
  439. Path: "/message_records/update",
  440. Handler: message_records.UpdateMessageRecordsHandler(serverCtx),
  441. },
  442. {
  443. Method: http.MethodPost,
  444. Path: "/message_records/delete",
  445. Handler: message_records.DeleteMessageRecordsHandler(serverCtx),
  446. },
  447. {
  448. Method: http.MethodPost,
  449. Path: "/message_records/list",
  450. Handler: message_records.GetMessageRecordsListHandler(serverCtx),
  451. },
  452. {
  453. Method: http.MethodPost,
  454. Path: "/message_records",
  455. Handler: message_records.GetMessageRecordsByIdHandler(serverCtx),
  456. },
  457. }...,
  458. ),
  459. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  460. )
  461. server.AddRoutes(
  462. rest.WithMiddlewares(
  463. []rest.Middleware{serverCtx.Authority},
  464. []rest.Route{
  465. {
  466. Method: http.MethodPost,
  467. Path: "/chatroom_member/list",
  468. Handler: ChatRoomMember.GetChatroomMemberListHandler(serverCtx),
  469. },
  470. }...,
  471. ),
  472. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  473. )
  474. server.AddRoutes(
  475. []rest.Route{
  476. {
  477. Method: http.MethodPost,
  478. Path: "/contact/getContactByWxid",
  479. Handler: openapi.OpenapiGetContactByWxidHandler(serverCtx),
  480. },
  481. {
  482. Method: http.MethodPost,
  483. Path: "/contact/getContactList",
  484. Handler: openapi.OpenapiGetContactListHandler(serverCtx),
  485. },
  486. },
  487. rest.WithPrefix("/openapi"),
  488. )
  489. server.AddRoutes(
  490. rest.WithMiddlewares(
  491. []rest.Middleware{serverCtx.Authority},
  492. []rest.Route{
  493. {
  494. Method: http.MethodPost,
  495. Path: "/batch_msg/create",
  496. Handler: batch_msg.CreateBatchMsgHandler(serverCtx),
  497. },
  498. {
  499. Method: http.MethodPost,
  500. Path: "/batch_msg/update",
  501. Handler: batch_msg.UpdateBatchMsgHandler(serverCtx),
  502. },
  503. {
  504. Method: http.MethodPost,
  505. Path: "/batch_msg/delete",
  506. Handler: batch_msg.DeleteBatchMsgHandler(serverCtx),
  507. },
  508. {
  509. Method: http.MethodPost,
  510. Path: "/batch_msg/list",
  511. Handler: batch_msg.GetBatchMsgListHandler(serverCtx),
  512. },
  513. {
  514. Method: http.MethodPost,
  515. Path: "/batch_msg",
  516. Handler: batch_msg.GetBatchMsgByIdHandler(serverCtx),
  517. },
  518. }...,
  519. ),
  520. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  521. )
  522. server.AddRoutes(
  523. rest.WithMiddlewares(
  524. []rest.Middleware{serverCtx.Authority},
  525. []rest.Route{
  526. {
  527. Method: http.MethodPost,
  528. Path: "/agent/create",
  529. Handler: agent.CreateAgentHandler(serverCtx),
  530. },
  531. {
  532. Method: http.MethodPost,
  533. Path: "/agent/update",
  534. Handler: agent.UpdateAgentHandler(serverCtx),
  535. },
  536. {
  537. Method: http.MethodPost,
  538. Path: "/agent/delete",
  539. Handler: agent.DeleteAgentHandler(serverCtx),
  540. },
  541. {
  542. Method: http.MethodPost,
  543. Path: "/agent/list",
  544. Handler: agent.GetAgentListHandler(serverCtx),
  545. },
  546. {
  547. Method: http.MethodPost,
  548. Path: "/agent",
  549. Handler: agent.GetAgentByIdHandler(serverCtx),
  550. },
  551. }...,
  552. ),
  553. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  554. )
  555. }