AdminPlatformDataController.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Result.DataCenter;
  4. using GxPress.Service.Interface.PlatformData;
  5. using Microsoft.AspNetCore.Authorization;
  6. using Microsoft.AspNetCore.Mvc;
  7. namespace GxPress.Api.AdminControllers
  8. {
  9. /// <summary>
  10. /// 平台数据
  11. /// </summary>
  12. [Route("api/admin/platform")]
  13. [ApiController]
  14. [Authorize]
  15. public class AdminPlatformDataController : Controller
  16. {
  17. private readonly IPlatformDataService platformDataService;
  18. public AdminPlatformDataController(IPlatformDataService platformDataService)
  19. {
  20. this.platformDataService = platformDataService;
  21. }
  22. /// <summary>
  23. /// 平台数据
  24. /// </summary>
  25. /// <returns></returns>
  26. [HttpGet("data")]
  27. public async Task<PlatformDataResult> GetPlatformDataResult()
  28. {
  29. var result = new PlatformDataResult();
  30. result.PlatformOperationDataResult = await platformDataService.GetPlatformDataAsync();
  31. result.UserIncreaseResult = await platformDataService.GetUserIncreaseResult();
  32. result.UserAreaDistributingResults = await platformDataService.GetUserAreaDistributingResults();
  33. result.UserVipProportionResult = await platformDataService.GetUserVipProportionResult();
  34. result.OnlineUserResult = await platformDataService.GetOnlineUserResult();
  35. result.PlatformContentDataResult = await platformDataService.GetPlatformContentDataResult();
  36. result.ContentTypeDistributingResult = await platformDataService.GetContentTypeDistributingResults();
  37. result.ContentOlogyDistributingResult = new List<ContentOlogyDistributingResult>();
  38. result.PayContentstatisticsResult = await platformDataService.GetPayContentstatisticsResult();
  39. result.ContentIncreaseResult = await platformDataService.GetContentIncreaseResult();
  40. result.PlatformAccumulativeVisitResult = await platformDataService.GetPlatformAccumulativeVisitResult();
  41. result.VisitPortResult = new List<VisitPortResult>();
  42. result.PlatformCommerceResult = await platformDataService.GetPlatformCommerceResult();
  43. result.ContentSaleRankingResults = await platformDataService.GetContentSaleRankingResults();
  44. result.ContentSaleProportionResults = await platformDataService.GetContentSaleProportionResults();
  45. return result;
  46. }
  47. /// <summary>
  48. /// 内容数据
  49. /// </summary>
  50. /// <returns></returns>
  51. [HttpGet("content-data")]
  52. public async Task<ContentDataResult> GetContentDataResult()
  53. {
  54. var result = new ContentDataResult();
  55. result.PlatformContentDataInfoResult = await platformDataService.GetPlatformContentDataInfoResults();
  56. result.ContentTypeDistributingResult = await platformDataService.GetContentTypeDistributingResults();
  57. result.ContentOlogyDistributingResult = new List<ContentOlogyDistributingResult>();
  58. result.PayContentstatisticsResult = await platformDataService.GetPayContentstatisticsResult();
  59. result.ContentIncreaseResult = await platformDataService.GetContentIncreaseResult();
  60. return result;
  61. }
  62. /// <summary>
  63. /// 访问数据
  64. /// /// </summary>
  65. /// <returns></returns>
  66. [HttpGet("visit-data")]
  67. public async Task<VisitDataResult> GetVisitDataResult()
  68. {
  69. var result = new VisitDataResult();
  70. result.PlatformAccumulativeVisitResult = await platformDataService.GetPlatformAccumulativeVisitResult();
  71. result.VisitPortResult = new List<VisitPortResult>();
  72. result.PlatformTodayVisitResult = await platformDataService.GetPlatformTodayVisitResult();
  73. return result;
  74. }
  75. /// <summary>
  76. /// 商务数据
  77. /// </summary>
  78. /// <returns></returns>
  79. [HttpGet("commerce-data")]
  80. public async Task<CommerceDataResult> GetCommerceDataResult()
  81. {
  82. return await platformDataService.GetCommerceDataResult();
  83. }
  84. /// <summary>
  85. /// 运营数据
  86. /// </summary>
  87. /// <returns></returns>
  88. [HttpGet("operation-data")]
  89. public async Task<OperationDataResult> GetOperationDataResult()
  90. {
  91. var result = new OperationDataResult();
  92. result.PlatformOperationDataResult = await platformDataService.GetPlatformDataAsync();
  93. result.UserIncreaseResult = await platformDataService.GetUserIncreaseResult();
  94. result.UserAreaDistributingResults = await platformDataService.GetUserAreaDistributingResults();
  95. result.UserVipProportionResult = await platformDataService.GetUserVipProportionResult();
  96. result.OnlineUserResult = await platformDataService.GetOnlineUserResult();
  97. return result;
  98. }
  99. }
  100. }