WexTestController.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Microsoft.AspNetCore.Authorization;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Wex.Sdk;
  4. using Wex.Sdk.Tel;
  5. namespace Hotline.Api.Controllers
  6. {
  7. [AllowAnonymous]
  8. public class WexTestController: BaseController
  9. {
  10. private readonly IWexClient _wexClient;
  11. public WexTestController(IWexClient wexClient)
  12. {
  13. _wexClient = wexClient;
  14. }
  15. /// <summary>
  16. /// 获取分机
  17. /// </summary>
  18. /// <returns></returns>
  19. [HttpGet("gettel")]
  20. public async Task<object> GetTel()
  21. {
  22. var rsp = await _wexClient.QueryTelsAsync(new QueryTelRequest { }, HttpContext.RequestAborted);
  23. return rsp;
  24. }
  25. /// <summary>
  26. /// 获取坐席组
  27. /// </summary>
  28. /// <returns></returns>
  29. [HttpGet("getgroup")]
  30. public async Task<object> GetGroup()
  31. {
  32. var rsp = await _wexClient.QueryGroupAsync(new QueryGroupRequest { }, HttpContext.RequestAborted);
  33. return rsp;
  34. }
  35. }
  36. }