routes.go 59 KB

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