routes.go 55 KB

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