routes.go 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338
  1. // Code generated by goctl. DO NOT EDIT.
  2. // goctls v1.10.1
  3. package handler
  4. import (
  5. "net/http"
  6. ChatRoomMember "wechat-api/internal/handler/ChatRoomMember"
  7. Message "wechat-api/internal/handler/Message"
  8. Msg "wechat-api/internal/handler/Msg"
  9. UsageDetail "wechat-api/internal/handler/UsageDetail"
  10. UsageTotal "wechat-api/internal/handler/UsageTotal"
  11. User "wechat-api/internal/handler/User"
  12. WechatServer "wechat-api/internal/handler/WechatServer"
  13. WorkPhone "wechat-api/internal/handler/WorkPhone"
  14. Wx "wechat-api/internal/handler/Wx"
  15. Wxhook "wechat-api/internal/handler/Wxhook"
  16. agent "wechat-api/internal/handler/agent"
  17. agent_base "wechat-api/internal/handler/agent_base"
  18. aliyun_avatar "wechat-api/internal/handler/aliyun_avatar"
  19. allocagent "wechat-api/internal/handler/allocagent"
  20. api_key "wechat-api/internal/handler/api_key"
  21. auth "wechat-api/internal/handler/auth"
  22. avatar "wechat-api/internal/handler/avatar"
  23. base "wechat-api/internal/handler/base"
  24. batch_msg "wechat-api/internal/handler/batch_msg"
  25. category "wechat-api/internal/handler/category"
  26. chat "wechat-api/internal/handler/chat"
  27. chatrecords "wechat-api/internal/handler/chatrecords"
  28. chatsession "wechat-api/internal/handler/chatsession"
  29. contact "wechat-api/internal/handler/contact"
  30. contact_field_template "wechat-api/internal/handler/contact_field_template"
  31. credit_balance "wechat-api/internal/handler/credit_balance"
  32. credit_usage "wechat-api/internal/handler/credit_usage"
  33. dashboard "wechat-api/internal/handler/dashboard"
  34. department "wechat-api/internal/handler/department"
  35. employee "wechat-api/internal/handler/employee"
  36. employee_config "wechat-api/internal/handler/employee_config"
  37. fastgpt "wechat-api/internal/handler/fastgpt"
  38. label "wechat-api/internal/handler/label"
  39. label_relationship "wechat-api/internal/handler/label_relationship"
  40. label_tagging "wechat-api/internal/handler/label_tagging"
  41. message_records "wechat-api/internal/handler/message_records"
  42. openapi "wechat-api/internal/handler/openapi"
  43. pay_recharge "wechat-api/internal/handler/pay_recharge"
  44. sop_node "wechat-api/internal/handler/sop_node"
  45. sop_stage "wechat-api/internal/handler/sop_stage"
  46. sop_task "wechat-api/internal/handler/sop_task"
  47. token "wechat-api/internal/handler/token"
  48. tutorial "wechat-api/internal/handler/tutorial"
  49. whatsapp "wechat-api/internal/handler/whatsapp"
  50. whatsapp_channel "wechat-api/internal/handler/whatsapp_channel"
  51. work_experience "wechat-api/internal/handler/work_experience"
  52. wp_wecom "wechat-api/internal/handler/wp_wecom"
  53. wxcard "wechat-api/internal/handler/wxcard"
  54. wxcarduser "wechat-api/internal/handler/wxcarduser"
  55. wxcardvisit "wechat-api/internal/handler/wxcardvisit"
  56. xiaoice "wechat-api/internal/handler/xiaoice"
  57. xunji "wechat-api/internal/handler/xunji"
  58. xunji_service "wechat-api/internal/handler/xunji_service"
  59. "wechat-api/internal/svc"
  60. "github.com/zeromicro/go-zero/rest"
  61. )
  62. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  63. server.AddRoutes(
  64. []rest.Route{
  65. {
  66. Method: http.MethodGet,
  67. Path: "/init/database",
  68. Handler: base.InitDatabaseHandler(serverCtx),
  69. },
  70. },
  71. )
  72. server.AddRoutes(
  73. rest.WithMiddlewares(
  74. []rest.Middleware{serverCtx.Authority},
  75. []rest.Route{
  76. {
  77. Method: http.MethodPost,
  78. Path: "/server/create",
  79. Handler: WechatServer.CreateServerHandler(serverCtx),
  80. },
  81. {
  82. Method: http.MethodPost,
  83. Path: "/server/update",
  84. Handler: WechatServer.UpdateServerHandler(serverCtx),
  85. },
  86. {
  87. Method: http.MethodPost,
  88. Path: "/server/delete",
  89. Handler: WechatServer.DeleteServerHandler(serverCtx),
  90. },
  91. {
  92. Method: http.MethodPost,
  93. Path: "/server/list",
  94. Handler: WechatServer.GetServerListHandler(serverCtx),
  95. },
  96. {
  97. Method: http.MethodPost,
  98. Path: "/server",
  99. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  100. },
  101. }...,
  102. ),
  103. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  104. )
  105. server.AddRoutes(
  106. rest.WithMiddlewares(
  107. []rest.Middleware{serverCtx.Authority},
  108. []rest.Route{
  109. {
  110. Method: http.MethodPost,
  111. Path: "/wx/create",
  112. Handler: Wx.CreateWxHandler(serverCtx),
  113. },
  114. {
  115. Method: http.MethodPost,
  116. Path: "/wx/check",
  117. Handler: Wx.CheckWxHandler(serverCtx),
  118. },
  119. {
  120. Method: http.MethodPost,
  121. Path: "/wx/update",
  122. Handler: Wx.UpdateWxHandler(serverCtx),
  123. },
  124. {
  125. Method: http.MethodPost,
  126. Path: "/wx/updateBlockAndAllowList",
  127. Handler: Wx.UpdateBlockAndAllowListHandler(serverCtx),
  128. },
  129. {
  130. Method: http.MethodPost,
  131. Path: "/wx/delete",
  132. Handler: Wx.DeleteWxHandler(serverCtx),
  133. },
  134. {
  135. Method: http.MethodPost,
  136. Path: "/wx/list",
  137. Handler: Wx.GetWxListHandler(serverCtx),
  138. },
  139. {
  140. Method: http.MethodPost,
  141. Path: "/wx/selectList",
  142. Handler: Wx.GetSelectWxListHandler(serverCtx),
  143. },
  144. {
  145. Method: http.MethodPost,
  146. Path: "/wx/getWxAllowBlockList",
  147. Handler: Wx.GetWxAllowBlockListHandler(serverCtx),
  148. },
  149. {
  150. Method: http.MethodPost,
  151. Path: "/wx",
  152. Handler: Wx.GetWxByIdHandler(serverCtx),
  153. },
  154. }...,
  155. ),
  156. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  157. )
  158. server.AddRoutes(
  159. rest.WithMiddlewares(
  160. []rest.Middleware{serverCtx.Authority},
  161. []rest.Route{
  162. {
  163. Method: http.MethodPost,
  164. Path: "/agent/data/batchDelete",
  165. Handler: agent.BatchDeleteAgentDataHandler(serverCtx),
  166. },
  167. {
  168. Method: http.MethodPost,
  169. Path: "/agent/data/upload",
  170. Handler: agent.UploadAgentDataHandler(serverCtx),
  171. },
  172. {
  173. Method: http.MethodPost,
  174. Path: "/agent/create",
  175. Handler: agent.CreateAgentHandler(serverCtx),
  176. },
  177. {
  178. Method: http.MethodPost,
  179. Path: "/agent/update",
  180. Handler: agent.UpdateAgentHandler(serverCtx),
  181. },
  182. {
  183. Method: http.MethodPost,
  184. Path: "/agent/delete",
  185. Handler: agent.DeleteAgentHandler(serverCtx),
  186. },
  187. {
  188. Method: http.MethodPost,
  189. Path: "/agent/list",
  190. Handler: agent.GetAgentListHandler(serverCtx),
  191. },
  192. {
  193. Method: http.MethodPost,
  194. Path: "/agent",
  195. Handler: agent.GetAgentByIdHandler(serverCtx),
  196. },
  197. {
  198. Method: http.MethodPost,
  199. Path: "/agent/collection/list",
  200. Handler: agent.GetAgentCollectionListHandler(serverCtx),
  201. },
  202. {
  203. Method: http.MethodPost,
  204. Path: "/agent/collection/detail",
  205. Handler: agent.GetAgentCollectionInfoHandler(serverCtx),
  206. },
  207. {
  208. Method: http.MethodPost,
  209. Path: "/agent/data/list",
  210. Handler: agent.GetAgentDataListHandler(serverCtx),
  211. },
  212. {
  213. Method: http.MethodPost,
  214. Path: "/agent/data/detail",
  215. Handler: agent.GetAgentDataDetailHandler(serverCtx),
  216. },
  217. {
  218. Method: http.MethodPost,
  219. Path: "/agent/data/create",
  220. Handler: agent.CreateAgentDataHandler(serverCtx),
  221. },
  222. {
  223. Method: http.MethodPost,
  224. Path: "/agent/data/update",
  225. Handler: agent.UpdateAgentDataHandler(serverCtx),
  226. },
  227. {
  228. Method: http.MethodPost,
  229. Path: "/agent/data/delete",
  230. Handler: agent.DeleteAgentDataHandler(serverCtx),
  231. },
  232. }...,
  233. ),
  234. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  235. )
  236. server.AddRoutes(
  237. rest.WithMiddlewares(
  238. []rest.Middleware{serverCtx.Authority},
  239. []rest.Route{
  240. {
  241. Method: http.MethodPost,
  242. Path: "/label_relationship/create",
  243. Handler: label_relationship.CreateLabelRelationshipHandler(serverCtx),
  244. },
  245. {
  246. Method: http.MethodPost,
  247. Path: "/label_relationship/update",
  248. Handler: label_relationship.UpdateLabelRelationshipHandler(serverCtx),
  249. },
  250. {
  251. Method: http.MethodPost,
  252. Path: "/label_relationship/update_contact_labels",
  253. Handler: label_relationship.UpdateLabelRelationshipsHandler(serverCtx),
  254. },
  255. {
  256. Method: http.MethodPost,
  257. Path: "/label_relationship/batch_update_contact_labels",
  258. Handler: label_relationship.BatchUpdateLabelRelationshipsHandler(serverCtx),
  259. },
  260. {
  261. Method: http.MethodPost,
  262. Path: "/label_relationship/delete",
  263. Handler: label_relationship.DeleteLabelRelationshipHandler(serverCtx),
  264. },
  265. {
  266. Method: http.MethodPost,
  267. Path: "/label_relationship/list",
  268. Handler: label_relationship.GetLabelRelationshipListHandler(serverCtx),
  269. },
  270. {
  271. Method: http.MethodPost,
  272. Path: "/label_relationship",
  273. Handler: label_relationship.GetLabelRelationshipByIdHandler(serverCtx),
  274. },
  275. {
  276. Method: http.MethodPost,
  277. Path: "/label_relationship/setWhatsappContactLabel",
  278. Handler: label_relationship.SetWhatsappContactLabelHandler(serverCtx),
  279. },
  280. {
  281. Method: http.MethodPost,
  282. Path: "/label_relationship/setWhatsappContactBatchLabel",
  283. Handler: label_relationship.SetWhatsappContactBatchLabelHandler(serverCtx),
  284. },
  285. }...,
  286. ),
  287. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  288. )
  289. server.AddRoutes(
  290. rest.WithMiddlewares(
  291. []rest.Middleware{serverCtx.Authority},
  292. []rest.Route{
  293. {
  294. Method: http.MethodPost,
  295. Path: "/contact_field_template/create",
  296. Handler: contact_field_template.CreateContactFieldTemplateHandler(serverCtx),
  297. },
  298. {
  299. Method: http.MethodPost,
  300. Path: "/contact_field_template/update",
  301. Handler: contact_field_template.UpdateContactFieldTemplateHandler(serverCtx),
  302. },
  303. {
  304. Method: http.MethodPost,
  305. Path: "/contact_field_template/delete",
  306. Handler: contact_field_template.DeleteContactFieldTemplateHandler(serverCtx),
  307. },
  308. {
  309. Method: http.MethodPost,
  310. Path: "/contact_field_template",
  311. Handler: contact_field_template.GetContactFieldTemplateByIdHandler(serverCtx),
  312. },
  313. }...,
  314. ),
  315. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  316. )
  317. server.AddRoutes(
  318. []rest.Route{
  319. {
  320. Method: http.MethodPost,
  321. Path: "/wxhook/sendTextMsg",
  322. Handler: Wxhook.SendTextMsgHandler(serverCtx),
  323. },
  324. },
  325. )
  326. server.AddRoutes(
  327. rest.WithMiddlewares(
  328. []rest.Middleware{serverCtx.Authority},
  329. []rest.Route{
  330. {
  331. Method: http.MethodPost,
  332. Path: "/wxhook/refreshLoginQR",
  333. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  334. },
  335. {
  336. Method: http.MethodPost,
  337. Path: "/wxhook/logout",
  338. Handler: Wxhook.LogoutHandler(serverCtx),
  339. },
  340. {
  341. Method: http.MethodPost,
  342. Path: "/wxhook/terminateThisWeChat",
  343. Handler: Wxhook.TerminateThisWeChatHandler(serverCtx),
  344. },
  345. {
  346. Method: http.MethodPost,
  347. Path: "/wxhook/getFriendsAndGroups",
  348. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  349. },
  350. {
  351. Method: http.MethodPost,
  352. Path: "/wxhook/sendPicMsg",
  353. Handler: Wxhook.SendPicMsgHandler(serverCtx),
  354. },
  355. {
  356. Method: http.MethodPost,
  357. Path: "/wxhook/sendPicMsgLocal",
  358. Handler: Wxhook.SendPicMsgLocalHandler(serverCtx),
  359. },
  360. }...,
  361. ),
  362. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  363. )
  364. server.AddRoutes(
  365. rest.WithMiddlewares(
  366. []rest.Middleware{serverCtx.Authority},
  367. []rest.Route{
  368. {
  369. Method: http.MethodPost,
  370. Path: "/contact/create",
  371. Handler: contact.CreateContactHandler(serverCtx),
  372. },
  373. {
  374. Method: http.MethodPost,
  375. Path: "/contact/update",
  376. Handler: contact.UpdateContactHandler(serverCtx),
  377. },
  378. {
  379. Method: http.MethodPost,
  380. Path: "/contact/delete",
  381. Handler: contact.DeleteContactHandler(serverCtx),
  382. },
  383. {
  384. Method: http.MethodPost,
  385. Path: "/contact/list",
  386. Handler: contact.GetContactListHandler(serverCtx),
  387. },
  388. {
  389. Method: http.MethodPost,
  390. Path: "/contact/simple",
  391. Handler: contact.GetContactSimpleListHandler(serverCtx),
  392. },
  393. {
  394. Method: http.MethodPost,
  395. Path: "/contact",
  396. Handler: contact.GetContactByIdHandler(serverCtx),
  397. },
  398. {
  399. Method: http.MethodPost,
  400. Path: "/contact/addNewFriend",
  401. Handler: contact.AddNewFriendHandler(serverCtx),
  402. },
  403. {
  404. Method: http.MethodPost,
  405. Path: "/contact/changeBlockList",
  406. Handler: contact.ChangeBlockListHandler(serverCtx),
  407. },
  408. {
  409. Method: http.MethodPost,
  410. Path: "/contact/importWhatsappContact",
  411. Handler: contact.ImportWhatsappContactHandler(serverCtx),
  412. },
  413. {
  414. Method: http.MethodPost,
  415. Path: "/contact/getWhatsappContactList",
  416. Handler: contact.GetWhatsappContactListHandler(serverCtx),
  417. },
  418. {
  419. Method: http.MethodPost,
  420. Path: "/contact/createWhatsappContact",
  421. Handler: contact.CreateWhatsappContactHandler(serverCtx),
  422. },
  423. {
  424. Method: http.MethodPost,
  425. Path: "/contact/updateWhatsappContact",
  426. Handler: contact.UpdateWhatsappContactHandler(serverCtx),
  427. },
  428. {
  429. Method: http.MethodPost,
  430. Path: "/contact/deleteWhatsappContact",
  431. Handler: contact.DeleteWhatsappContactHandler(serverCtx),
  432. },
  433. {
  434. Method: http.MethodPost,
  435. Path: "/contact/getWhatsappContact",
  436. Handler: contact.GetWhatsappContactHandler(serverCtx),
  437. },
  438. }...,
  439. ),
  440. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  441. )
  442. server.AddRoutes(
  443. rest.WithMiddlewares(
  444. []rest.Middleware{serverCtx.Authority},
  445. []rest.Route{
  446. {
  447. Method: http.MethodPost,
  448. Path: "/message/create",
  449. Handler: Message.CreateMessageHandler(serverCtx),
  450. },
  451. {
  452. Method: http.MethodPost,
  453. Path: "/message/update",
  454. Handler: Message.UpdateMessageHandler(serverCtx),
  455. },
  456. {
  457. Method: http.MethodPost,
  458. Path: "/message/delete",
  459. Handler: Message.DeleteMessageHandler(serverCtx),
  460. },
  461. {
  462. Method: http.MethodPost,
  463. Path: "/message/list",
  464. Handler: Message.GetMessageListHandler(serverCtx),
  465. },
  466. {
  467. Method: http.MethodPost,
  468. Path: "/message",
  469. Handler: Message.GetMessageByIdHandler(serverCtx),
  470. },
  471. }...,
  472. ),
  473. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  474. )
  475. server.AddRoutes(
  476. rest.WithMiddlewares(
  477. []rest.Middleware{serverCtx.Authority},
  478. []rest.Route{
  479. {
  480. Method: http.MethodPost,
  481. Path: "/label/create",
  482. Handler: label.CreateLabelHandler(serverCtx),
  483. },
  484. {
  485. Method: http.MethodPost,
  486. Path: "/label/update",
  487. Handler: label.UpdateLabelHandler(serverCtx),
  488. },
  489. {
  490. Method: http.MethodPost,
  491. Path: "/label/delete",
  492. Handler: label.DeleteLabelHandler(serverCtx),
  493. },
  494. {
  495. Method: http.MethodPost,
  496. Path: "/label/list",
  497. Handler: label.GetLabelListHandler(serverCtx),
  498. },
  499. {
  500. Method: http.MethodPost,
  501. Path: "/label/select_list",
  502. Handler: label.GetLabelSelectListHandler(serverCtx),
  503. },
  504. {
  505. Method: http.MethodPost,
  506. Path: "/label/batch_select_list",
  507. Handler: label.GetLabelBatchSelectListHandler(serverCtx),
  508. },
  509. {
  510. Method: http.MethodPost,
  511. Path: "/label/contacts",
  512. Handler: label.GetLabelContactsHandler(serverCtx),
  513. },
  514. {
  515. Method: http.MethodPost,
  516. Path: "/label",
  517. Handler: label.GetLabelByIdHandler(serverCtx),
  518. },
  519. }...,
  520. ),
  521. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  522. )
  523. server.AddRoutes(
  524. rest.WithMiddlewares(
  525. []rest.Middleware{serverCtx.Authority},
  526. []rest.Route{
  527. {
  528. Method: http.MethodPost,
  529. Path: "/label_tagging/create",
  530. Handler: label_tagging.CreateLabelTaggingHandler(serverCtx),
  531. },
  532. {
  533. Method: http.MethodPost,
  534. Path: "/label_tagging/update",
  535. Handler: label_tagging.UpdateLabelTaggingHandler(serverCtx),
  536. },
  537. {
  538. Method: http.MethodPost,
  539. Path: "/label_tagging/delete",
  540. Handler: label_tagging.DeleteLabelTaggingHandler(serverCtx),
  541. },
  542. {
  543. Method: http.MethodPost,
  544. Path: "/label_tagging/list",
  545. Handler: label_tagging.GetLabelTaggingListHandler(serverCtx),
  546. },
  547. {
  548. Method: http.MethodPost,
  549. Path: "/label_tagging",
  550. Handler: label_tagging.GetLabelTaggingByIdHandler(serverCtx),
  551. },
  552. }...,
  553. ),
  554. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  555. )
  556. server.AddRoutes(
  557. []rest.Route{
  558. {
  559. Method: http.MethodPost,
  560. Path: "/api/sop_task/list",
  561. Handler: sop_task.GetApiSopTaskListHandler(serverCtx),
  562. },
  563. },
  564. )
  565. server.AddRoutes(
  566. rest.WithMiddlewares(
  567. []rest.Middleware{serverCtx.Authority},
  568. []rest.Route{
  569. {
  570. Method: http.MethodPost,
  571. Path: "/sop_task/create",
  572. Handler: sop_task.CreateSopTaskHandler(serverCtx),
  573. },
  574. {
  575. Method: http.MethodPost,
  576. Path: "/sop_task/update",
  577. Handler: sop_task.UpdateSopTaskHandler(serverCtx),
  578. },
  579. {
  580. Method: http.MethodPost,
  581. Path: "/sop_task/delete",
  582. Handler: sop_task.DeleteSopTaskHandler(serverCtx),
  583. },
  584. {
  585. Method: http.MethodPost,
  586. Path: "/sop_task/list",
  587. Handler: sop_task.GetSopTaskListHandler(serverCtx),
  588. },
  589. {
  590. Method: http.MethodPost,
  591. Path: "/sop_task/record_list",
  592. Handler: sop_task.GetSopTaskRecordListHandler(serverCtx),
  593. },
  594. {
  595. Method: http.MethodPost,
  596. Path: "/sop_task",
  597. Handler: sop_task.GetSopTaskByIdHandler(serverCtx),
  598. },
  599. {
  600. Method: http.MethodPost,
  601. Path: "/sop_task/detail",
  602. Handler: sop_task.GetSopTaskDetailHandler(serverCtx),
  603. },
  604. {
  605. Method: http.MethodPost,
  606. Path: "/sop_task/publish",
  607. Handler: sop_task.PublishSopTaskHandler(serverCtx),
  608. },
  609. {
  610. Method: http.MethodPost,
  611. Path: "/sop_task/start",
  612. Handler: sop_task.SopTaskStartHandler(serverCtx),
  613. },
  614. {
  615. Method: http.MethodPost,
  616. Path: "/sop_task/stop",
  617. Handler: sop_task.SopTaskStopHandler(serverCtx),
  618. },
  619. {
  620. Method: http.MethodPost,
  621. Path: "/sop_task/copy",
  622. Handler: sop_task.SopTaskCopyHandler(serverCtx),
  623. },
  624. {
  625. Method: http.MethodPost,
  626. Path: "/sop_task/message_var",
  627. Handler: sop_task.GetSopMessageVarHandler(serverCtx),
  628. },
  629. {
  630. Method: http.MethodPost,
  631. Path: "/sop_task/outline",
  632. Handler: sop_task.GetSopTaskOutlineHandler(serverCtx),
  633. },
  634. {
  635. Method: http.MethodPost,
  636. Path: "/sop_task/test_node",
  637. Handler: sop_task.TestNodeHandler(serverCtx),
  638. },
  639. {
  640. Method: http.MethodPost,
  641. Path: "/sop_task/generate_ai_answer",
  642. Handler: sop_task.GenerateAiAnswerHandler(serverCtx),
  643. },
  644. }...,
  645. ),
  646. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  647. )
  648. server.AddRoutes(
  649. []rest.Route{
  650. {
  651. Method: http.MethodPost,
  652. Path: "/api/sop_stage/list",
  653. Handler: sop_stage.GetApiSopStageListHandler(serverCtx),
  654. },
  655. },
  656. )
  657. server.AddRoutes(
  658. rest.WithMiddlewares(
  659. []rest.Middleware{serverCtx.Authority},
  660. []rest.Route{
  661. {
  662. Method: http.MethodPost,
  663. Path: "/sop_stage/create",
  664. Handler: sop_stage.CreateSopStageHandler(serverCtx),
  665. },
  666. {
  667. Method: http.MethodPost,
  668. Path: "/sop_stage/update",
  669. Handler: sop_stage.UpdateSopStageHandler(serverCtx),
  670. },
  671. {
  672. Method: http.MethodPost,
  673. Path: "/sop_stage/delete",
  674. Handler: sop_stage.DeleteSopStageHandler(serverCtx),
  675. },
  676. {
  677. Method: http.MethodPost,
  678. Path: "/sop_stage/list",
  679. Handler: sop_stage.GetSopStageListHandler(serverCtx),
  680. },
  681. {
  682. Method: http.MethodPost,
  683. Path: "/sop_stage",
  684. Handler: sop_stage.GetSopStageByIdHandler(serverCtx),
  685. },
  686. {
  687. Method: http.MethodPost,
  688. Path: "/sop_stage/detail",
  689. Handler: sop_stage.GetSopStageDetailHandler(serverCtx),
  690. },
  691. {
  692. Method: http.MethodPost,
  693. Path: "/sop_stage/move",
  694. Handler: sop_stage.MoveSopStageHandler(serverCtx),
  695. },
  696. {
  697. Method: http.MethodPost,
  698. Path: "/sop_stage/copy",
  699. Handler: sop_stage.SopStageCopyHandler(serverCtx),
  700. },
  701. }...,
  702. ),
  703. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  704. )
  705. server.AddRoutes(
  706. []rest.Route{
  707. {
  708. Method: http.MethodPost,
  709. Path: "/api/sop_node/list",
  710. Handler: sop_node.GetApiSopNodeListHandler(serverCtx),
  711. },
  712. },
  713. )
  714. server.AddRoutes(
  715. rest.WithMiddlewares(
  716. []rest.Middleware{serverCtx.Authority},
  717. []rest.Route{
  718. {
  719. Method: http.MethodPost,
  720. Path: "/sop_node/create",
  721. Handler: sop_node.CreateSopNodeHandler(serverCtx),
  722. },
  723. {
  724. Method: http.MethodPost,
  725. Path: "/sop_node/update",
  726. Handler: sop_node.UpdateSopNodeHandler(serverCtx),
  727. },
  728. {
  729. Method: http.MethodPost,
  730. Path: "/sop_node/delete",
  731. Handler: sop_node.DeleteSopNodeHandler(serverCtx),
  732. },
  733. {
  734. Method: http.MethodPost,
  735. Path: "/sop_node/list",
  736. Handler: sop_node.GetSopNodeListHandler(serverCtx),
  737. },
  738. {
  739. Method: http.MethodPost,
  740. Path: "/sop_node/detail",
  741. Handler: sop_node.GetSopNodeDetailHandler(serverCtx),
  742. },
  743. }...,
  744. ),
  745. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  746. )
  747. server.AddRoutes(
  748. rest.WithMiddlewares(
  749. []rest.Middleware{serverCtx.Authority},
  750. []rest.Route{
  751. {
  752. Method: http.MethodPost,
  753. Path: "/message_records/create",
  754. Handler: message_records.CreateMessageRecordsHandler(serverCtx),
  755. },
  756. {
  757. Method: http.MethodPost,
  758. Path: "/message_records/update",
  759. Handler: message_records.UpdateMessageRecordsHandler(serverCtx),
  760. },
  761. {
  762. Method: http.MethodPost,
  763. Path: "/message_records/delete",
  764. Handler: message_records.DeleteMessageRecordsHandler(serverCtx),
  765. },
  766. {
  767. Method: http.MethodPost,
  768. Path: "/message_records/list",
  769. Handler: message_records.GetMessageRecordsListHandler(serverCtx),
  770. },
  771. {
  772. Method: http.MethodPost,
  773. Path: "/message_records",
  774. Handler: message_records.GetMessageRecordsByIdHandler(serverCtx),
  775. },
  776. }...,
  777. ),
  778. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  779. )
  780. server.AddRoutes(
  781. rest.WithMiddlewares(
  782. []rest.Middleware{serverCtx.Authority},
  783. []rest.Route{
  784. {
  785. Method: http.MethodPost,
  786. Path: "/chatroom_member/list",
  787. Handler: ChatRoomMember.GetChatroomMemberListHandler(serverCtx),
  788. },
  789. }...,
  790. ),
  791. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  792. )
  793. server.AddRoutes(
  794. []rest.Route{
  795. {
  796. Method: http.MethodPost,
  797. Path: "/api/user/login",
  798. Handler: User.DoApiUserLoginHandler(serverCtx),
  799. },
  800. {
  801. Method: http.MethodPost,
  802. Path: "/gpts/user/login",
  803. Handler: User.DoGptsUserLoginHandler(serverCtx),
  804. },
  805. {
  806. Method: http.MethodPost,
  807. Path: "/gpts/user/info",
  808. Handler: User.GetGptsUserInfoHandler(serverCtx),
  809. },
  810. {
  811. Method: http.MethodPost,
  812. Path: "/gpts/user/update",
  813. Handler: User.UpdateGptsUserInfoHandler(serverCtx),
  814. },
  815. {
  816. Method: http.MethodPost,
  817. Path: "/gpts/user/balance",
  818. Handler: User.GetGptsUserBalanceHandler(serverCtx),
  819. },
  820. {
  821. Method: http.MethodPost,
  822. Path: "/gpts/user/password",
  823. Handler: User.UpdateGptsUserPwdHandler(serverCtx),
  824. },
  825. },
  826. )
  827. server.AddRoutes(
  828. rest.WithMiddlewares(
  829. []rest.Middleware{serverCtx.Miniprogram},
  830. []rest.Route{
  831. {
  832. Method: http.MethodPost,
  833. Path: "/api/user/vip",
  834. Handler: User.GetApiUserVipHandler(serverCtx),
  835. },
  836. }...,
  837. ),
  838. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  839. )
  840. server.AddRoutes(
  841. rest.WithMiddlewares(
  842. []rest.Middleware{serverCtx.Authority},
  843. []rest.Route{
  844. {
  845. Method: http.MethodGet,
  846. Path: "/user/info",
  847. Handler: User.GetUserInfoHandler(serverCtx),
  848. },
  849. }...,
  850. ),
  851. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  852. )
  853. server.AddRoutes(
  854. []rest.Route{
  855. {
  856. Method: http.MethodPost,
  857. Path: "/contact/getContactByWxid",
  858. Handler: openapi.OpenapiGetContactByWxidHandler(serverCtx),
  859. },
  860. {
  861. Method: http.MethodPost,
  862. Path: "/contact/getContactList",
  863. Handler: openapi.OpenapiGetContactListHandler(serverCtx),
  864. },
  865. },
  866. rest.WithPrefix("/openapi"),
  867. )
  868. server.AddRoutes(
  869. []rest.Route{
  870. {
  871. Method: http.MethodGet,
  872. Path: "/chat/getauth",
  873. Handler: chat.GetAuthHandler(serverCtx),
  874. },
  875. },
  876. rest.WithPrefix("/v1"),
  877. )
  878. server.AddRoutes(
  879. rest.WithMiddlewares(
  880. []rest.Middleware{serverCtx.OpenAuthority},
  881. []rest.Route{
  882. {
  883. Method: http.MethodPost,
  884. Path: "/chat/completions",
  885. Handler: chat.ChatCompletionsHandler(serverCtx),
  886. },
  887. }...,
  888. ),
  889. rest.WithPrefix("/v1"),
  890. )
  891. server.AddRoutes(
  892. rest.WithMiddlewares(
  893. []rest.Middleware{serverCtx.OpenAuthority},
  894. []rest.Route{
  895. {
  896. Method: http.MethodPost,
  897. Path: "/wx/sendTextMsg",
  898. Handler: chat.SendTextMsgHandler(serverCtx),
  899. },
  900. }...,
  901. ),
  902. )
  903. server.AddRoutes(
  904. rest.WithMiddlewares(
  905. []rest.Middleware{serverCtx.Authority},
  906. []rest.Route{
  907. {
  908. Method: http.MethodPost,
  909. Path: "/batch_msg/create",
  910. Handler: batch_msg.CreateBatchMsgHandler(serverCtx),
  911. },
  912. {
  913. Method: http.MethodPost,
  914. Path: "/batch_msg/update",
  915. Handler: batch_msg.UpdateBatchMsgHandler(serverCtx),
  916. },
  917. {
  918. Method: http.MethodPost,
  919. Path: "/batch_msg/delete",
  920. Handler: batch_msg.DeleteBatchMsgHandler(serverCtx),
  921. },
  922. {
  923. Method: http.MethodPost,
  924. Path: "/batch_msg/list",
  925. Handler: batch_msg.GetBatchMsgListHandler(serverCtx),
  926. },
  927. {
  928. Method: http.MethodPost,
  929. Path: "/batch_msg",
  930. Handler: batch_msg.GetBatchMsgByIdHandler(serverCtx),
  931. },
  932. {
  933. Method: http.MethodPost,
  934. Path: "/batch_msg/stop",
  935. Handler: batch_msg.StopBatchMsgHandler(serverCtx),
  936. },
  937. {
  938. Method: http.MethodPost,
  939. Path: "/batch_msg/getWhatcappBatchMsgList",
  940. Handler: batch_msg.GetWhatcappBatchMsgListHandler(serverCtx),
  941. },
  942. {
  943. Method: http.MethodPost,
  944. Path: "/batch_msg/createWhatcappBatchMsg",
  945. Handler: batch_msg.CreateWhatcappBatchMsgHandler(serverCtx),
  946. },
  947. {
  948. Method: http.MethodPost,
  949. Path: "/batch_msg/updateWhatcappBatchMsg",
  950. Handler: batch_msg.UpdateWhatcappBatchMsgHandler(serverCtx),
  951. },
  952. {
  953. Method: http.MethodPost,
  954. Path: "/batch_msg/getWhatcappBatchMsg",
  955. Handler: batch_msg.GetWhatcappBatchMsgHandler(serverCtx),
  956. },
  957. {
  958. Method: http.MethodPost,
  959. Path: "/batch_msg/removeWhatcappBatchMsg",
  960. Handler: batch_msg.RemoveWhatcappBatchMsgHandler(serverCtx),
  961. },
  962. {
  963. Method: http.MethodPost,
  964. Path: "/batch_msg/getWhatcappBatchMsgHistory",
  965. Handler: batch_msg.GetWhatcappBatchMsgHistoryHandler(serverCtx),
  966. },
  967. {
  968. Method: http.MethodPost,
  969. Path: "/batch_msg/sendBatchMsgText",
  970. Handler: batch_msg.SendBatchMsgTextHandler(serverCtx),
  971. },
  972. }...,
  973. ),
  974. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  975. )
  976. server.AddRoutes(
  977. rest.WithMiddlewares(
  978. []rest.Middleware{serverCtx.Authority},
  979. []rest.Route{
  980. {
  981. Method: http.MethodPost,
  982. Path: "/msg/create",
  983. Handler: Msg.CreateMsgHandler(serverCtx),
  984. },
  985. {
  986. Method: http.MethodPost,
  987. Path: "/msg/update",
  988. Handler: Msg.UpdateMsgHandler(serverCtx),
  989. },
  990. {
  991. Method: http.MethodPost,
  992. Path: "/msg/delete",
  993. Handler: Msg.DeleteMsgHandler(serverCtx),
  994. },
  995. {
  996. Method: http.MethodPost,
  997. Path: "/msg/list",
  998. Handler: Msg.GetMsgListHandler(serverCtx),
  999. },
  1000. {
  1001. Method: http.MethodPost,
  1002. Path: "/msg",
  1003. Handler: Msg.GetMsgByIdHandler(serverCtx),
  1004. },
  1005. }...,
  1006. ),
  1007. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1008. )
  1009. server.AddRoutes(
  1010. []rest.Route{
  1011. {
  1012. Method: http.MethodPost,
  1013. Path: "/api/employee/list",
  1014. Handler: employee.GetApiEmployeeListHandler(serverCtx),
  1015. },
  1016. {
  1017. Method: http.MethodPost,
  1018. Path: "/api/employee/detail",
  1019. Handler: employee.GetApiEmployeeDetailHandler(serverCtx),
  1020. },
  1021. },
  1022. )
  1023. server.AddRoutes(
  1024. []rest.Route{
  1025. {
  1026. Method: http.MethodPost,
  1027. Path: "/employee/search",
  1028. Handler: employee.GetEmployeeSearchHandler(serverCtx),
  1029. },
  1030. {
  1031. Method: http.MethodPost,
  1032. Path: "/employee/search/test",
  1033. Handler: employee.GetEmployeeSearchTestHandler(serverCtx),
  1034. },
  1035. {
  1036. Method: http.MethodPost,
  1037. Path: "/employee/detail",
  1038. Handler: employee.GetEmployeeDetailHandler(serverCtx),
  1039. },
  1040. },
  1041. )
  1042. server.AddRoutes(
  1043. rest.WithMiddlewares(
  1044. []rest.Middleware{serverCtx.Authority},
  1045. []rest.Route{
  1046. {
  1047. Method: http.MethodPost,
  1048. Path: "/employee/create",
  1049. Handler: employee.CreateEmployeeHandler(serverCtx),
  1050. },
  1051. {
  1052. Method: http.MethodPost,
  1053. Path: "/employee/update",
  1054. Handler: employee.UpdateEmployeeHandler(serverCtx),
  1055. },
  1056. {
  1057. Method: http.MethodPost,
  1058. Path: "/employee/delete",
  1059. Handler: employee.DeleteEmployeeHandler(serverCtx),
  1060. },
  1061. {
  1062. Method: http.MethodPost,
  1063. Path: "/employee/list",
  1064. Handler: employee.GetEmployeeListHandler(serverCtx),
  1065. },
  1066. {
  1067. Method: http.MethodPost,
  1068. Path: "/employee",
  1069. Handler: employee.GetEmployeeByIdHandler(serverCtx),
  1070. },
  1071. }...,
  1072. ),
  1073. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1074. )
  1075. server.AddRoutes(
  1076. rest.WithMiddlewares(
  1077. []rest.Middleware{serverCtx.Authority},
  1078. []rest.Route{
  1079. {
  1080. Method: http.MethodPost,
  1081. Path: "/work_experience/create",
  1082. Handler: work_experience.CreateWorkExperienceHandler(serverCtx),
  1083. },
  1084. {
  1085. Method: http.MethodPost,
  1086. Path: "/work_experience/update",
  1087. Handler: work_experience.UpdateWorkExperienceHandler(serverCtx),
  1088. },
  1089. {
  1090. Method: http.MethodPost,
  1091. Path: "/work_experience/delete",
  1092. Handler: work_experience.DeleteWorkExperienceHandler(serverCtx),
  1093. },
  1094. {
  1095. Method: http.MethodPost,
  1096. Path: "/work_experience/list",
  1097. Handler: work_experience.GetWorkExperienceListHandler(serverCtx),
  1098. },
  1099. {
  1100. Method: http.MethodPost,
  1101. Path: "/work_experience",
  1102. Handler: work_experience.GetWorkExperienceByIdHandler(serverCtx),
  1103. },
  1104. }...,
  1105. ),
  1106. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1107. )
  1108. server.AddRoutes(
  1109. rest.WithMiddlewares(
  1110. []rest.Middleware{serverCtx.Authority},
  1111. []rest.Route{
  1112. {
  1113. Method: http.MethodPost,
  1114. Path: "/tutorial/create",
  1115. Handler: tutorial.CreateTutorialHandler(serverCtx),
  1116. },
  1117. {
  1118. Method: http.MethodPost,
  1119. Path: "/tutorial/update",
  1120. Handler: tutorial.UpdateTutorialHandler(serverCtx),
  1121. },
  1122. {
  1123. Method: http.MethodPost,
  1124. Path: "/tutorial/delete",
  1125. Handler: tutorial.DeleteTutorialHandler(serverCtx),
  1126. },
  1127. {
  1128. Method: http.MethodPost,
  1129. Path: "/tutorial/list",
  1130. Handler: tutorial.GetTutorialListHandler(serverCtx),
  1131. },
  1132. {
  1133. Method: http.MethodPost,
  1134. Path: "/tutorial",
  1135. Handler: tutorial.GetTutorialByIdHandler(serverCtx),
  1136. },
  1137. }...,
  1138. ),
  1139. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1140. )
  1141. server.AddRoutes(
  1142. rest.WithMiddlewares(
  1143. []rest.Middleware{serverCtx.Authority},
  1144. []rest.Route{
  1145. {
  1146. Method: http.MethodGet,
  1147. Path: "/employee_config/list",
  1148. Handler: employee_config.GetEmployeeListConfigHandler(serverCtx),
  1149. },
  1150. }...,
  1151. ),
  1152. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1153. )
  1154. server.AddRoutes(
  1155. []rest.Route{
  1156. {
  1157. Method: http.MethodPost,
  1158. Path: "/token/check",
  1159. Handler: token.CheckTokenHandler(serverCtx),
  1160. },
  1161. },
  1162. )
  1163. server.AddRoutes(
  1164. rest.WithMiddlewares(
  1165. []rest.Middleware{serverCtx.Authority},
  1166. []rest.Route{
  1167. {
  1168. Method: http.MethodPost,
  1169. Path: "/token/third/create",
  1170. Handler: token.CreateTokenHandler(serverCtx),
  1171. },
  1172. {
  1173. Method: http.MethodPost,
  1174. Path: "/token/third/update",
  1175. Handler: token.UpdateTokenHandler(serverCtx),
  1176. },
  1177. {
  1178. Method: http.MethodPost,
  1179. Path: "/token/third/delete",
  1180. Handler: token.DeleteTokenHandler(serverCtx),
  1181. },
  1182. {
  1183. Method: http.MethodPost,
  1184. Path: "/token/third/list",
  1185. Handler: token.GetTokenListHandler(serverCtx),
  1186. },
  1187. {
  1188. Method: http.MethodPost,
  1189. Path: "/token/api/list",
  1190. Handler: token.GetApiTokenListHandler(serverCtx),
  1191. },
  1192. {
  1193. Method: http.MethodPost,
  1194. Path: "/token/third/detail",
  1195. Handler: token.GetTokenByIdHandler(serverCtx),
  1196. },
  1197. {
  1198. Method: http.MethodPost,
  1199. Path: "/token/third/clear",
  1200. Handler: token.ClearTokenByIdHandler(serverCtx),
  1201. },
  1202. }...,
  1203. ),
  1204. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1205. )
  1206. server.AddRoutes(
  1207. []rest.Route{
  1208. {
  1209. Method: http.MethodPost,
  1210. Path: "/category/list",
  1211. Handler: category.GetCategoryListHandler(serverCtx),
  1212. },
  1213. {
  1214. Method: http.MethodPost,
  1215. Path: "/category",
  1216. Handler: category.GetCategoryByIdHandler(serverCtx),
  1217. },
  1218. {
  1219. Method: http.MethodPost,
  1220. Path: "/api/category/list",
  1221. Handler: category.GetApiCategoryListHandler(serverCtx),
  1222. },
  1223. },
  1224. )
  1225. server.AddRoutes(
  1226. rest.WithMiddlewares(
  1227. []rest.Middleware{serverCtx.Authority},
  1228. []rest.Route{
  1229. {
  1230. Method: http.MethodPost,
  1231. Path: "/category/create",
  1232. Handler: category.CreateCategoryHandler(serverCtx),
  1233. },
  1234. {
  1235. Method: http.MethodPost,
  1236. Path: "/category/update",
  1237. Handler: category.UpdateCategoryHandler(serverCtx),
  1238. },
  1239. {
  1240. Method: http.MethodPost,
  1241. Path: "/category/delete",
  1242. Handler: category.DeleteCategoryHandler(serverCtx),
  1243. },
  1244. }...,
  1245. ),
  1246. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1247. )
  1248. server.AddRoutes(
  1249. rest.WithMiddlewares(
  1250. []rest.Middleware{serverCtx.Authority},
  1251. []rest.Route{
  1252. {
  1253. Method: http.MethodPost,
  1254. Path: "/agent_base/create",
  1255. Handler: agent_base.CreateAgentBaseHandler(serverCtx),
  1256. },
  1257. {
  1258. Method: http.MethodPost,
  1259. Path: "/agent_base/update",
  1260. Handler: agent_base.UpdateAgentBaseHandler(serverCtx),
  1261. },
  1262. {
  1263. Method: http.MethodPost,
  1264. Path: "/agent_base/delete",
  1265. Handler: agent_base.DeleteAgentBaseHandler(serverCtx),
  1266. },
  1267. {
  1268. Method: http.MethodPost,
  1269. Path: "/agent_base/list",
  1270. Handler: agent_base.GetAgentBaseListHandler(serverCtx),
  1271. },
  1272. {
  1273. Method: http.MethodPost,
  1274. Path: "/agent_base",
  1275. Handler: agent_base.GetAgentBaseByIdHandler(serverCtx),
  1276. },
  1277. }...,
  1278. ),
  1279. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1280. )
  1281. server.AddRoutes(
  1282. []rest.Route{
  1283. {
  1284. Method: http.MethodPost,
  1285. Path: "/gpts/chat/submit",
  1286. Handler: chatrecords.GptsSubmitApiChatHandler(serverCtx),
  1287. },
  1288. {
  1289. Method: http.MethodPost,
  1290. Path: "/gpts/chat/message",
  1291. Handler: chatrecords.GptsGetApiMessageHandler(serverCtx),
  1292. },
  1293. {
  1294. Method: http.MethodPost,
  1295. Path: "/gpts/chat/session",
  1296. Handler: chatrecords.GptsGetApiSessionHandler(serverCtx),
  1297. },
  1298. {
  1299. Method: http.MethodPost,
  1300. Path: "/gpts/chat/session/delete",
  1301. Handler: chatrecords.GptsDeleteApiSessionHandler(serverCtx),
  1302. },
  1303. {
  1304. Method: http.MethodPost,
  1305. Path: "/gpts/chat/session/rename",
  1306. Handler: chatrecords.GptsRenameApiSessionHandler(serverCtx),
  1307. },
  1308. },
  1309. )
  1310. server.AddRoutes(
  1311. rest.WithMiddlewares(
  1312. []rest.Middleware{serverCtx.Miniprogram},
  1313. []rest.Route{
  1314. {
  1315. Method: http.MethodPost,
  1316. Path: "/api/chat/create",
  1317. Handler: chatrecords.SubmitApiChatHandler(serverCtx),
  1318. },
  1319. {
  1320. Method: http.MethodPost,
  1321. Path: "/api/chat/answer",
  1322. Handler: chatrecords.AnswerApiChatHandler(serverCtx),
  1323. },
  1324. {
  1325. Method: http.MethodPost,
  1326. Path: "/api/chat/list",
  1327. Handler: chatrecords.GetApiChatListHandler(serverCtx),
  1328. },
  1329. {
  1330. Method: http.MethodPost,
  1331. Path: "/api/chat/recommmend",
  1332. Handler: chatrecords.GetApiRecommendChatHandler(serverCtx),
  1333. },
  1334. }...,
  1335. ),
  1336. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1337. )
  1338. server.AddRoutes(
  1339. rest.WithMiddlewares(
  1340. []rest.Middleware{serverCtx.Authority},
  1341. []rest.Route{
  1342. {
  1343. Method: http.MethodPost,
  1344. Path: "/chat_records/create",
  1345. Handler: chatrecords.CreateChatRecordsHandler(serverCtx),
  1346. },
  1347. {
  1348. Method: http.MethodPost,
  1349. Path: "/chat_records/update",
  1350. Handler: chatrecords.UpdateChatRecordsHandler(serverCtx),
  1351. },
  1352. {
  1353. Method: http.MethodPost,
  1354. Path: "/chat_records/delete",
  1355. Handler: chatrecords.DeleteChatRecordsHandler(serverCtx),
  1356. },
  1357. {
  1358. Method: http.MethodPost,
  1359. Path: "/chat_records/list",
  1360. Handler: chatrecords.GetChatRecordsListHandler(serverCtx),
  1361. },
  1362. {
  1363. Method: http.MethodPost,
  1364. Path: "/chat_records",
  1365. Handler: chatrecords.GetChatRecordsByIdHandler(serverCtx),
  1366. },
  1367. }...,
  1368. ),
  1369. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1370. )
  1371. server.AddRoutes(
  1372. rest.WithMiddlewares(
  1373. []rest.Middleware{serverCtx.Miniprogram},
  1374. []rest.Route{
  1375. {
  1376. Method: http.MethodPost,
  1377. Path: "/api/session/list",
  1378. Handler: chatsession.GetApiSessionListHandler(serverCtx),
  1379. },
  1380. {
  1381. Method: http.MethodPost,
  1382. Path: "/api/session/update",
  1383. Handler: chatsession.UpdateApiSessionHandler(serverCtx),
  1384. },
  1385. {
  1386. Method: http.MethodPost,
  1387. Path: "/api/session/delete",
  1388. Handler: chatsession.DeleteApiSessionHandler(serverCtx),
  1389. },
  1390. }...,
  1391. ),
  1392. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1393. )
  1394. server.AddRoutes(
  1395. rest.WithMiddlewares(
  1396. []rest.Middleware{serverCtx.Authority},
  1397. []rest.Route{
  1398. {
  1399. Method: http.MethodPost,
  1400. Path: "/chat_session/create",
  1401. Handler: chatsession.CreateChatSessionHandler(serverCtx),
  1402. },
  1403. {
  1404. Method: http.MethodPost,
  1405. Path: "/chat_session/update",
  1406. Handler: chatsession.UpdateChatSessionHandler(serverCtx),
  1407. },
  1408. {
  1409. Method: http.MethodPost,
  1410. Path: "/chat_session/delete",
  1411. Handler: chatsession.DeleteChatSessionHandler(serverCtx),
  1412. },
  1413. {
  1414. Method: http.MethodPost,
  1415. Path: "/chat_session/list",
  1416. Handler: chatsession.GetChatSessionListHandler(serverCtx),
  1417. },
  1418. {
  1419. Method: http.MethodPost,
  1420. Path: "/chat_session",
  1421. Handler: chatsession.GetChatSessionByIdHandler(serverCtx),
  1422. },
  1423. }...,
  1424. ),
  1425. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1426. )
  1427. server.AddRoutes(
  1428. rest.WithMiddlewares(
  1429. []rest.Middleware{serverCtx.Miniprogram},
  1430. []rest.Route{
  1431. {
  1432. Method: http.MethodPost,
  1433. Path: "/api/card/detail",
  1434. Handler: wxcard.GetApiWxCardDetailHandler(serverCtx),
  1435. },
  1436. }...,
  1437. ),
  1438. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1439. )
  1440. server.AddRoutes(
  1441. []rest.Route{
  1442. {
  1443. Method: http.MethodGet,
  1444. Path: "/api/card/qrcode",
  1445. Handler: wxcard.GetApiWxCardQrcodeHandler(serverCtx),
  1446. },
  1447. },
  1448. )
  1449. server.AddRoutes(
  1450. rest.WithMiddlewares(
  1451. []rest.Middleware{serverCtx.Authority},
  1452. []rest.Route{
  1453. {
  1454. Method: http.MethodPost,
  1455. Path: "/wx_card/create",
  1456. Handler: wxcard.CreateWxCardHandler(serverCtx),
  1457. },
  1458. {
  1459. Method: http.MethodPost,
  1460. Path: "/wx_card/update",
  1461. Handler: wxcard.UpdateWxCardHandler(serverCtx),
  1462. },
  1463. {
  1464. Method: http.MethodPost,
  1465. Path: "/wx_card/delete",
  1466. Handler: wxcard.DeleteWxCardHandler(serverCtx),
  1467. },
  1468. {
  1469. Method: http.MethodPost,
  1470. Path: "/wx_card/list",
  1471. Handler: wxcard.GetWxCardListHandler(serverCtx),
  1472. },
  1473. {
  1474. Method: http.MethodPost,
  1475. Path: "/wx_card",
  1476. Handler: wxcard.GetWxCardByIdHandler(serverCtx),
  1477. },
  1478. }...,
  1479. ),
  1480. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1481. )
  1482. server.AddRoutes(
  1483. rest.WithMiddlewares(
  1484. []rest.Middleware{serverCtx.Miniprogram},
  1485. []rest.Route{
  1486. {
  1487. Method: http.MethodPost,
  1488. Path: "/api/user/update",
  1489. Handler: wxcarduser.UpdateApiWxCardUserHandler(serverCtx),
  1490. },
  1491. }...,
  1492. ),
  1493. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1494. )
  1495. server.AddRoutes(
  1496. rest.WithMiddlewares(
  1497. []rest.Middleware{serverCtx.Authority},
  1498. []rest.Route{
  1499. {
  1500. Method: http.MethodPost,
  1501. Path: "/wx_card_user/create",
  1502. Handler: wxcarduser.CreateWxCardUserHandler(serverCtx),
  1503. },
  1504. {
  1505. Method: http.MethodPost,
  1506. Path: "/wx_card_user/update",
  1507. Handler: wxcarduser.UpdateWxCardUserHandler(serverCtx),
  1508. },
  1509. {
  1510. Method: http.MethodPost,
  1511. Path: "/wx_card_user/delete",
  1512. Handler: wxcarduser.DeleteWxCardUserHandler(serverCtx),
  1513. },
  1514. {
  1515. Method: http.MethodPost,
  1516. Path: "/wx_card_user/list",
  1517. Handler: wxcarduser.GetWxCardUserListHandler(serverCtx),
  1518. },
  1519. {
  1520. Method: http.MethodPost,
  1521. Path: "/wx_card_user",
  1522. Handler: wxcarduser.GetWxCardUserByIdHandler(serverCtx),
  1523. },
  1524. }...,
  1525. ),
  1526. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1527. )
  1528. server.AddRoutes(
  1529. rest.WithMiddlewares(
  1530. []rest.Middleware{serverCtx.Miniprogram},
  1531. []rest.Route{
  1532. {
  1533. Method: http.MethodPost,
  1534. Path: "/api/card/visit",
  1535. Handler: wxcardvisit.SubmitApiWxCardVisitHandler(serverCtx),
  1536. },
  1537. {
  1538. Method: http.MethodPost,
  1539. Path: "/api/card/visit/history",
  1540. Handler: wxcardvisit.GetApiWxCardVisitListHandler(serverCtx),
  1541. },
  1542. }...,
  1543. ),
  1544. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1545. )
  1546. server.AddRoutes(
  1547. rest.WithMiddlewares(
  1548. []rest.Middleware{serverCtx.Authority},
  1549. []rest.Route{
  1550. {
  1551. Method: http.MethodPost,
  1552. Path: "/wx_card_visit/create",
  1553. Handler: wxcardvisit.CreateWxCardVisitHandler(serverCtx),
  1554. },
  1555. {
  1556. Method: http.MethodPost,
  1557. Path: "/wx_card_visit/update",
  1558. Handler: wxcardvisit.UpdateWxCardVisitHandler(serverCtx),
  1559. },
  1560. {
  1561. Method: http.MethodPost,
  1562. Path: "/wx_card_visit/delete",
  1563. Handler: wxcardvisit.DeleteWxCardVisitHandler(serverCtx),
  1564. },
  1565. {
  1566. Method: http.MethodPost,
  1567. Path: "/wx_card_visit/list",
  1568. Handler: wxcardvisit.GetWxCardVisitListHandler(serverCtx),
  1569. },
  1570. {
  1571. Method: http.MethodPost,
  1572. Path: "/wx_card_visit",
  1573. Handler: wxcardvisit.GetWxCardVisitByIdHandler(serverCtx),
  1574. },
  1575. }...,
  1576. ),
  1577. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1578. )
  1579. server.AddRoutes(
  1580. rest.WithMiddlewares(
  1581. []rest.Middleware{serverCtx.Miniprogram},
  1582. []rest.Route{
  1583. {
  1584. Method: http.MethodPost,
  1585. Path: "/api/avatar/config",
  1586. Handler: avatar.GetApiAvatarConfigHandler(serverCtx),
  1587. },
  1588. {
  1589. Method: http.MethodPost,
  1590. Path: "/api/avatar/sendText",
  1591. Handler: avatar.SendApiAvatarTextHandler(serverCtx),
  1592. },
  1593. {
  1594. Method: http.MethodPost,
  1595. Path: "/api/avatar/stop",
  1596. Handler: avatar.StopApiAvatarHandler(serverCtx),
  1597. },
  1598. {
  1599. Method: http.MethodPost,
  1600. Path: "/api/avatar/sts",
  1601. Handler: avatar.GetAcsResponseHandler(serverCtx),
  1602. },
  1603. {
  1604. Method: http.MethodPost,
  1605. Path: "/api/avatar/signature",
  1606. Handler: avatar.GetSignatureResponseHandler(serverCtx),
  1607. },
  1608. }...,
  1609. ),
  1610. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1611. )
  1612. server.AddRoutes(
  1613. rest.WithMiddlewares(
  1614. []rest.Middleware{serverCtx.Authority},
  1615. []rest.Route{
  1616. {
  1617. Method: http.MethodPost,
  1618. Path: "/aliyun_avatar/create",
  1619. Handler: aliyun_avatar.CreateAliyunAvatarHandler(serverCtx),
  1620. },
  1621. {
  1622. Method: http.MethodPost,
  1623. Path: "/aliyun_avatar/update",
  1624. Handler: aliyun_avatar.UpdateAliyunAvatarHandler(serverCtx),
  1625. },
  1626. {
  1627. Method: http.MethodPost,
  1628. Path: "/aliyun_avatar/delete",
  1629. Handler: aliyun_avatar.DeleteAliyunAvatarHandler(serverCtx),
  1630. },
  1631. {
  1632. Method: http.MethodPost,
  1633. Path: "/aliyun_avatar/list",
  1634. Handler: aliyun_avatar.GetAliyunAvatarListHandler(serverCtx),
  1635. },
  1636. {
  1637. Method: http.MethodPost,
  1638. Path: "/aliyun_avatar",
  1639. Handler: aliyun_avatar.GetAliyunAvatarByIdHandler(serverCtx),
  1640. },
  1641. }...,
  1642. ),
  1643. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1644. )
  1645. server.AddRoutes(
  1646. rest.WithMiddlewares(
  1647. []rest.Middleware{serverCtx.Authority},
  1648. []rest.Route{
  1649. {
  1650. Method: http.MethodPost,
  1651. Path: "/workphone/wxaccount/refresh",
  1652. Handler: WorkPhone.WxRefreshHandler(serverCtx),
  1653. },
  1654. {
  1655. Method: http.MethodPost,
  1656. Path: "/workphone/Qwaccount/refresh",
  1657. Handler: WorkPhone.QwRefreshHandler(serverCtx),
  1658. },
  1659. }...,
  1660. ),
  1661. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1662. )
  1663. server.AddRoutes(
  1664. rest.WithMiddlewares(
  1665. []rest.Middleware{serverCtx.Authority},
  1666. []rest.Route{
  1667. {
  1668. Method: http.MethodPost,
  1669. Path: "/usage_detail/list",
  1670. Handler: UsageDetail.GetUsageDetailListHandler(serverCtx),
  1671. },
  1672. {
  1673. Method: http.MethodPost,
  1674. Path: "/usage_detail",
  1675. Handler: UsageDetail.GetUsageDetailHandler(serverCtx),
  1676. },
  1677. }...,
  1678. ),
  1679. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1680. )
  1681. server.AddRoutes(
  1682. rest.WithMiddlewares(
  1683. []rest.Middleware{serverCtx.Authority},
  1684. []rest.Route{
  1685. {
  1686. Method: http.MethodPost,
  1687. Path: "/usage_total/list",
  1688. Handler: UsageTotal.GetUsageTotalListHandler(serverCtx),
  1689. },
  1690. }...,
  1691. ),
  1692. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1693. )
  1694. server.AddRoutes(
  1695. rest.WithMiddlewares(
  1696. []rest.Middleware{serverCtx.Authority},
  1697. []rest.Route{
  1698. {
  1699. Method: http.MethodPost,
  1700. Path: "/alloc_agent/create",
  1701. Handler: allocagent.CreateAllocAgentHandler(serverCtx),
  1702. },
  1703. {
  1704. Method: http.MethodPost,
  1705. Path: "/alloc_agent/update",
  1706. Handler: allocagent.UpdateAllocAgentHandler(serverCtx),
  1707. },
  1708. {
  1709. Method: http.MethodPost,
  1710. Path: "/alloc_agent/delete",
  1711. Handler: allocagent.DeleteAllocAgentHandler(serverCtx),
  1712. },
  1713. {
  1714. Method: http.MethodPost,
  1715. Path: "/alloc_agent/list",
  1716. Handler: allocagent.GetAllocAgentListHandler(serverCtx),
  1717. },
  1718. {
  1719. Method: http.MethodPost,
  1720. Path: "/alloc_agent",
  1721. Handler: allocagent.GetAllocAgentByIdHandler(serverCtx),
  1722. },
  1723. {
  1724. Method: http.MethodPost,
  1725. Path: "/alloc_agent/query",
  1726. Handler: allocagent.QueryAllocAgentHandler(serverCtx),
  1727. },
  1728. {
  1729. Method: http.MethodPost,
  1730. Path: "/alloc_agent/alloc",
  1731. Handler: allocagent.DoAllocAgentHandler(serverCtx),
  1732. },
  1733. }...,
  1734. ),
  1735. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1736. )
  1737. server.AddRoutes(
  1738. []rest.Route{
  1739. {
  1740. Method: http.MethodGet,
  1741. Path: "/api/xiaoice/signature",
  1742. Handler: xiaoice.SignatureGenHandler(serverCtx),
  1743. },
  1744. {
  1745. Method: http.MethodPost,
  1746. Path: "/api/xiaoice/message",
  1747. Handler: xiaoice.GptbotsMessageHandler(serverCtx),
  1748. },
  1749. {
  1750. Method: http.MethodPost,
  1751. Path: "/api/xiaoice/chat",
  1752. Handler: xiaoice.GptbotsChatHandler(serverCtx),
  1753. },
  1754. },
  1755. )
  1756. server.AddRoutes(
  1757. rest.WithMiddlewares(
  1758. []rest.Middleware{serverCtx.Authority},
  1759. []rest.Route{
  1760. {
  1761. Method: http.MethodPost,
  1762. Path: "/dashboard/charts",
  1763. Handler: dashboard.GetChartsHandler(serverCtx),
  1764. },
  1765. {
  1766. Method: http.MethodPost,
  1767. Path: "/dashboard/wx",
  1768. Handler: dashboard.GetWxsHandler(serverCtx),
  1769. },
  1770. }...,
  1771. ),
  1772. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1773. )
  1774. server.AddRoutes(
  1775. rest.WithMiddlewares(
  1776. []rest.Middleware{serverCtx.Authority},
  1777. []rest.Route{
  1778. {
  1779. Method: http.MethodPost,
  1780. Path: "/credit_balance/create",
  1781. Handler: credit_balance.CreateCreditBalanceHandler(serverCtx),
  1782. },
  1783. {
  1784. Method: http.MethodPost,
  1785. Path: "/credit_balance/update",
  1786. Handler: credit_balance.UpdateCreditBalanceHandler(serverCtx),
  1787. },
  1788. {
  1789. Method: http.MethodPost,
  1790. Path: "/credit_balance/delete",
  1791. Handler: credit_balance.DeleteCreditBalanceHandler(serverCtx),
  1792. },
  1793. {
  1794. Method: http.MethodPost,
  1795. Path: "/credit_balance/list",
  1796. Handler: credit_balance.GetCreditBalanceListHandler(serverCtx),
  1797. },
  1798. {
  1799. Method: http.MethodPost,
  1800. Path: "/credit_balance",
  1801. Handler: credit_balance.GetCreditBalanceByIdHandler(serverCtx),
  1802. },
  1803. {
  1804. Method: http.MethodPost,
  1805. Path: "/credit_balance/operate",
  1806. Handler: credit_balance.OperateCreditBalanceHandler(serverCtx),
  1807. },
  1808. }...,
  1809. ),
  1810. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1811. )
  1812. server.AddRoutes(
  1813. rest.WithMiddlewares(
  1814. []rest.Middleware{serverCtx.Authority},
  1815. []rest.Route{
  1816. {
  1817. Method: http.MethodPost,
  1818. Path: "/credit_usage/create",
  1819. Handler: credit_usage.CreateCreditUsageHandler(serverCtx),
  1820. },
  1821. {
  1822. Method: http.MethodPost,
  1823. Path: "/credit_usage/update",
  1824. Handler: credit_usage.UpdateCreditUsageHandler(serverCtx),
  1825. },
  1826. {
  1827. Method: http.MethodPost,
  1828. Path: "/credit_usage/delete",
  1829. Handler: credit_usage.DeleteCreditUsageHandler(serverCtx),
  1830. },
  1831. {
  1832. Method: http.MethodPost,
  1833. Path: "/credit_usage/list",
  1834. Handler: credit_usage.GetCreditUsageListHandler(serverCtx),
  1835. },
  1836. {
  1837. Method: http.MethodPost,
  1838. Path: "/credit_usage",
  1839. Handler: credit_usage.GetCreditUsageByIdHandler(serverCtx),
  1840. },
  1841. }...,
  1842. ),
  1843. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1844. )
  1845. server.AddRoutes(
  1846. rest.WithMiddlewares(
  1847. []rest.Middleware{serverCtx.Authority},
  1848. []rest.Route{
  1849. {
  1850. Method: http.MethodPost,
  1851. Path: "/pay_recharge/create",
  1852. Handler: pay_recharge.CreatePayRechargeHandler(serverCtx),
  1853. },
  1854. {
  1855. Method: http.MethodPost,
  1856. Path: "/pay_recharge/update",
  1857. Handler: pay_recharge.UpdatePayRechargeHandler(serverCtx),
  1858. },
  1859. {
  1860. Method: http.MethodPost,
  1861. Path: "/pay_recharge/delete",
  1862. Handler: pay_recharge.DeletePayRechargeHandler(serverCtx),
  1863. },
  1864. {
  1865. Method: http.MethodPost,
  1866. Path: "/pay_recharge/list",
  1867. Handler: pay_recharge.GetPayRechargeListHandler(serverCtx),
  1868. },
  1869. {
  1870. Method: http.MethodPost,
  1871. Path: "/pay_recharge",
  1872. Handler: pay_recharge.GetPayRechargeByIdHandler(serverCtx),
  1873. },
  1874. }...,
  1875. ),
  1876. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  1877. )
  1878. server.AddRoutes(
  1879. rest.WithMiddlewares(
  1880. []rest.Middleware{serverCtx.Authority},
  1881. []rest.Route{
  1882. {
  1883. Method: http.MethodPost,
  1884. Path: "/whatsapp/create",
  1885. Handler: whatsapp.CreateWhatsappHandler(serverCtx),
  1886. },
  1887. {
  1888. Method: http.MethodPost,
  1889. Path: "/whatsapp/update",
  1890. Handler: whatsapp.UpdateWhatsappHandler(serverCtx),
  1891. },
  1892. {
  1893. Method: http.MethodPost,
  1894. Path: "/whatsapp/delete",
  1895. Handler: whatsapp.DeleteWhatsappHandler(serverCtx),
  1896. },
  1897. {
  1898. Method: http.MethodPost,
  1899. Path: "/whatsapp/list",
  1900. Handler: whatsapp.GetWhatsappListHandler(serverCtx),
  1901. },
  1902. {
  1903. Method: http.MethodPost,
  1904. Path: "/whatsapp",
  1905. Handler: whatsapp.GetWhatsappByIdHandler(serverCtx),
  1906. },
  1907. {
  1908. Method: http.MethodPost,
  1909. Path: "/whatsapp/sendCode",
  1910. Handler: whatsapp.SendWhatsappCodeHandler(serverCtx),
  1911. },
  1912. {
  1913. Method: http.MethodPost,
  1914. Path: "/whatsapp/submitCode",
  1915. Handler: whatsapp.SubmitWhatsappCodeHandler(serverCtx),
  1916. },
  1917. {
  1918. Method: http.MethodPost,
  1919. Path: "/whatsapp/getAutomation",
  1920. Handler: whatsapp.GetAutomationHandler(serverCtx),
  1921. },
  1922. {
  1923. Method: http.MethodPost,
  1924. Path: "/whatsapp/setAutomation",
  1925. Handler: whatsapp.SetAutomationHandler(serverCtx),
  1926. },
  1927. {
  1928. Method: http.MethodPost,
  1929. Path: "/whatsapp/getQrcode",
  1930. Handler: whatsapp.GetQrcodeHandler(serverCtx),
  1931. },
  1932. {
  1933. Method: http.MethodPost,
  1934. Path: "/whatsapp/createQrcode",
  1935. Handler: whatsapp.CreateQrcodeHandler(serverCtx),
  1936. },
  1937. {
  1938. Method: http.MethodPost,
  1939. Path: "/whatsapp/removeQrcode",
  1940. Handler: whatsapp.RemoveQrcodeHandler(serverCtx),
  1941. },
  1942. {
  1943. Method: http.MethodPost,
  1944. Path: "/whatsapp/updateQrcode",
  1945. Handler: whatsapp.UpdateQrcodeHandler(serverCtx),
  1946. },
  1947. {
  1948. Method: http.MethodPost,
  1949. Path: "/whatsapp/getBusinessInfo",
  1950. Handler: whatsapp.GetBusinessInfoHandler(serverCtx),
  1951. },
  1952. {
  1953. Method: http.MethodPost,
  1954. Path: "/whatsapp/setBusinessInfo",
  1955. Handler: whatsapp.SetBusinessInfoHandler(serverCtx),
  1956. },
  1957. {
  1958. Method: http.MethodPost,
  1959. Path: "/whatsapp/registerPhoneNumber",
  1960. Handler: whatsapp.RegisterPhoneNumberHandler(serverCtx),
  1961. },
  1962. {
  1963. Method: http.MethodPost,
  1964. Path: "/whatsapp/deregisterPhoneNumber",
  1965. Handler: whatsapp.DeregisterPhoneNumberHandler(serverCtx),
  1966. },
  1967. {
  1968. Method: http.MethodPost,
  1969. Path: "/whatsapp/updateAgent",
  1970. Handler: whatsapp.UpdateAgentHandler(serverCtx),
  1971. },
  1972. {
  1973. Method: http.MethodPost,
  1974. Path: "/whatsapp/getAllowBlockList",
  1975. Handler: whatsapp.GetAllowBlockListHandler(serverCtx),
  1976. },
  1977. {
  1978. Method: http.MethodPost,
  1979. Path: "/whatsapp/updateAllowAndBlockList",
  1980. Handler: whatsapp.UpdateAllowAndBlockListHandler(serverCtx),
  1981. },
  1982. {
  1983. Method: http.MethodPost,
  1984. Path: "/whatsapp/updateAgentApi",
  1985. Handler: whatsapp.UpdateAgentApiHandler(serverCtx),
  1986. },
  1987. {
  1988. Method: http.MethodPost,
  1989. Path: "/whatsapp/createTemplate",
  1990. Handler: whatsapp.CreateWhatsappTemplateHandler(serverCtx),
  1991. },
  1992. {
  1993. Method: http.MethodPost,
  1994. Path: "/whatsapp/listTemplate",
  1995. Handler: whatsapp.ListWhatsappTemplateHandler(serverCtx),
  1996. },
  1997. {
  1998. Method: http.MethodPost,
  1999. Path: "/whatsapp/removeTemplate",
  2000. Handler: whatsapp.RemoveWhatsappTemplateHandler(serverCtx),
  2001. },
  2002. {
  2003. Method: http.MethodPost,
  2004. Path: "/whatsapp/editTemplate",
  2005. Handler: whatsapp.EditWhatsappTemplateHandler(serverCtx),
  2006. },
  2007. {
  2008. Method: http.MethodPost,
  2009. Path: "/whatsapp/getTemplate",
  2010. Handler: whatsapp.GetWhatsappTemplateHandler(serverCtx),
  2011. },
  2012. }...,
  2013. ),
  2014. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2015. )
  2016. server.AddRoutes(
  2017. rest.WithMiddlewares(
  2018. []rest.Middleware{serverCtx.Authority},
  2019. []rest.Route{
  2020. {
  2021. Method: http.MethodPost,
  2022. Path: "/whatsapp_channel/create",
  2023. Handler: whatsapp_channel.CreateWhatsappChannelHandler(serverCtx),
  2024. },
  2025. {
  2026. Method: http.MethodPost,
  2027. Path: "/whatsapp_channel/update",
  2028. Handler: whatsapp_channel.UpdateWhatsappChannelHandler(serverCtx),
  2029. },
  2030. {
  2031. Method: http.MethodPost,
  2032. Path: "/whatsapp_channel/delete",
  2033. Handler: whatsapp_channel.DeleteWhatsappChannelHandler(serverCtx),
  2034. },
  2035. {
  2036. Method: http.MethodPost,
  2037. Path: "/whatsapp_channel/list",
  2038. Handler: whatsapp_channel.GetWhatsappChannelListHandler(serverCtx),
  2039. },
  2040. {
  2041. Method: http.MethodPost,
  2042. Path: "/whatsapp_channel/search",
  2043. Handler: whatsapp_channel.GetWhatsappChannelSearchHandler(serverCtx),
  2044. },
  2045. {
  2046. Method: http.MethodPost,
  2047. Path: "/whatsapp_channel",
  2048. Handler: whatsapp_channel.GetWhatsappChannelByIdHandler(serverCtx),
  2049. },
  2050. }...,
  2051. ),
  2052. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2053. )
  2054. server.AddRoutes(
  2055. rest.WithMiddlewares(
  2056. []rest.Middleware{serverCtx.Authority},
  2057. []rest.Route{
  2058. {
  2059. Method: http.MethodPost,
  2060. Path: "/xunji/create",
  2061. Handler: xunji.CreateXunjiHandler(serverCtx),
  2062. },
  2063. {
  2064. Method: http.MethodPost,
  2065. Path: "/xunji/update",
  2066. Handler: xunji.UpdateXunjiHandler(serverCtx),
  2067. },
  2068. {
  2069. Method: http.MethodPost,
  2070. Path: "/xunji/delete",
  2071. Handler: xunji.DeleteXunjiHandler(serverCtx),
  2072. },
  2073. {
  2074. Method: http.MethodPost,
  2075. Path: "/xunji/list",
  2076. Handler: xunji.GetXunjiListHandler(serverCtx),
  2077. },
  2078. {
  2079. Method: http.MethodPost,
  2080. Path: "/xunji",
  2081. Handler: xunji.GetXunjiByIdHandler(serverCtx),
  2082. },
  2083. {
  2084. Method: http.MethodPost,
  2085. Path: "/xunji/detail",
  2086. Handler: xunji.GetXunjiHandler(serverCtx),
  2087. },
  2088. }...,
  2089. ),
  2090. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2091. )
  2092. server.AddRoutes(
  2093. rest.WithMiddlewares(
  2094. []rest.Middleware{serverCtx.Authority},
  2095. []rest.Route{
  2096. {
  2097. Method: http.MethodPost,
  2098. Path: "/xunji_service/create",
  2099. Handler: xunji_service.CreateXunjiServiceHandler(serverCtx),
  2100. },
  2101. {
  2102. Method: http.MethodPost,
  2103. Path: "/xunji_service/update",
  2104. Handler: xunji_service.UpdateXunjiServiceHandler(serverCtx),
  2105. },
  2106. {
  2107. Method: http.MethodPost,
  2108. Path: "/xunji_service/delete",
  2109. Handler: xunji_service.DeleteXunjiServiceHandler(serverCtx),
  2110. },
  2111. {
  2112. Method: http.MethodPost,
  2113. Path: "/xunji_service/list",
  2114. Handler: xunji_service.GetXunjiServiceListHandler(serverCtx),
  2115. },
  2116. {
  2117. Method: http.MethodPost,
  2118. Path: "/xunji_service",
  2119. Handler: xunji_service.GetXunjiServiceByIdHandler(serverCtx),
  2120. },
  2121. }...,
  2122. ),
  2123. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2124. )
  2125. server.AddRoutes(
  2126. []rest.Route{
  2127. {
  2128. Method: http.MethodPost,
  2129. Path: "/wp/wecom/send_msg",
  2130. Handler: wp_wecom.SendMsgHandler(serverCtx),
  2131. },
  2132. {
  2133. Method: http.MethodPost,
  2134. Path: "/wp/wecom/send_msg_by_chan",
  2135. Handler: wp_wecom.SendMsgByChanHandler(serverCtx),
  2136. },
  2137. },
  2138. )
  2139. server.AddRoutes(
  2140. []rest.Route{
  2141. {
  2142. Method: http.MethodGet,
  2143. Path: "/api/fastgpt/set_token",
  2144. Handler: fastgpt.SetTokenHandler(serverCtx),
  2145. },
  2146. {
  2147. Method: http.MethodPost,
  2148. Path: "/api/fastgpt/create",
  2149. Handler: fastgpt.CreateFastgptHandler(serverCtx),
  2150. },
  2151. },
  2152. )
  2153. server.AddRoutes(
  2154. rest.WithMiddlewares(
  2155. []rest.Middleware{serverCtx.Authority},
  2156. []rest.Route{
  2157. {
  2158. Method: http.MethodPost,
  2159. Path: "/api/fastgpt/apps_list",
  2160. Handler: fastgpt.GetAppsListHandler(serverCtx),
  2161. },
  2162. {
  2163. Method: http.MethodPost,
  2164. Path: "/api/fastgpt/create_app",
  2165. Handler: fastgpt.CreateAppHandler(serverCtx),
  2166. },
  2167. {
  2168. Method: http.MethodPost,
  2169. Path: "/api/fastgpt/update_app",
  2170. Handler: fastgpt.UpdateAppHandler(serverCtx),
  2171. },
  2172. {
  2173. Method: http.MethodPost,
  2174. Path: "/api/fastgpt/delete_app",
  2175. Handler: fastgpt.DeleteAppHandler(serverCtx),
  2176. },
  2177. }...,
  2178. ),
  2179. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2180. )
  2181. server.AddRoutes(
  2182. rest.WithMiddlewares(
  2183. []rest.Middleware{serverCtx.Authority},
  2184. []rest.Route{
  2185. {
  2186. Method: http.MethodPost,
  2187. Path: "/department/create",
  2188. Handler: department.CreateDepartmentHandler(serverCtx),
  2189. },
  2190. {
  2191. Method: http.MethodPost,
  2192. Path: "/department/update",
  2193. Handler: department.UpdateDepartmentHandler(serverCtx),
  2194. },
  2195. {
  2196. Method: http.MethodPost,
  2197. Path: "/department/delete",
  2198. Handler: department.DeleteDepartmentHandler(serverCtx),
  2199. },
  2200. {
  2201. Method: http.MethodPost,
  2202. Path: "/department/list",
  2203. Handler: department.GetDepartmentListHandler(serverCtx),
  2204. },
  2205. {
  2206. Method: http.MethodPost,
  2207. Path: "/department",
  2208. Handler: department.GetDepartmentByIdHandler(serverCtx),
  2209. },
  2210. }...,
  2211. ),
  2212. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2213. )
  2214. server.AddRoutes(
  2215. rest.WithMiddlewares(
  2216. []rest.Middleware{serverCtx.Authority},
  2217. []rest.Route{
  2218. {
  2219. Method: http.MethodPost,
  2220. Path: "/api_key/create",
  2221. Handler: api_key.CreateApiKeyHandler(serverCtx),
  2222. },
  2223. {
  2224. Method: http.MethodPost,
  2225. Path: "/api_key/update",
  2226. Handler: api_key.UpdateApiKeyHandler(serverCtx),
  2227. },
  2228. {
  2229. Method: http.MethodPost,
  2230. Path: "/api_key/delete",
  2231. Handler: api_key.DeleteApiKeyHandler(serverCtx),
  2232. },
  2233. {
  2234. Method: http.MethodPost,
  2235. Path: "/api_key/list",
  2236. Handler: api_key.GetApiKeyListHandler(serverCtx),
  2237. },
  2238. }...,
  2239. ),
  2240. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  2241. )
  2242. server.AddRoutes(
  2243. []rest.Route{
  2244. {
  2245. Method: http.MethodPost,
  2246. Path: "/user/login",
  2247. Handler: auth.LoginHandler(serverCtx),
  2248. },
  2249. {
  2250. Method: http.MethodPost,
  2251. Path: "/user/login_by_email",
  2252. Handler: auth.LoginByEmailHandler(serverCtx),
  2253. },
  2254. {
  2255. Method: http.MethodPost,
  2256. Path: "/user/login_by_sms",
  2257. Handler: auth.LoginBySmsHandler(serverCtx),
  2258. },
  2259. },
  2260. )
  2261. }