routes.go 59 KB

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