routes.go 55 KB

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