routes.go 56 KB

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