routes.go 60 KB

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