routes.go 60 KB

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