routes.go 59 KB

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