routes.go 59 KB

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