routes.go 56 KB

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