routes.go 56 KB

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