routes.go 60 KB

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