routes.go 57 KB

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