routes.go 59 KB

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