routes.go 59 KB

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