routes.go 58 KB

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