routes.go 60 KB

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