routes.go 59 KB

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