AppPageController.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Common.Page;
  4. using GxPress.Request.ArticleGroup;
  5. using GxPress.Request.Media;
  6. using GxPress.Request.TeacherRequest;
  7. using GxPress.Result.Media;
  8. using GxPress.Result.SystemLabel;
  9. using GxPress.Result.Teacher;
  10. using GxPress.Service.Interface.AppHomePage;
  11. using Microsoft.AspNetCore.Authorization;
  12. using Microsoft.AspNetCore.Mvc;
  13. namespace GxPress.Api.AppControllers
  14. {
  15. /// <summary>
  16. /// App首页数据
  17. /// </summary>
  18. [Route("api/app/page")]
  19. [ApiController]
  20. [Authorize]
  21. public class AppPageController : Controller
  22. {
  23. private readonly IAppHomePageService appHomePageService;
  24. public AppPageController(IAppHomePageService appHomePageService)
  25. {
  26. this.appHomePageService = appHomePageService;
  27. }
  28. /// <summary>
  29. /// 大咖讲座
  30. /// </summary>
  31. /// <param name="request"></param>
  32. /// <returns></returns>
  33. [HttpPost("cathedra")]
  34. [AllowAnonymous]
  35. public async Task<List<AppLabelResult<MediaCathedraResult>>> GetMediasByTeacherAsync(ArticleGroupRequest request)
  36. {
  37. if (string.IsNullOrEmpty(request.StyleCss))
  38. throw new Common.Exceptions.BusinessException("样式未知!");
  39. return await appHomePageService.GetMediasByTeacherAsync(request);
  40. }
  41. /// <summary>
  42. /// 大咖讲座分页接口
  43. /// </summary>
  44. /// <returns></returns>
  45. [HttpPost("cathedra-page")]
  46. [AllowAnonymous]
  47. public async Task<PagedList<MediaCathedraResult>> MediaCathedraResult(ArticleGroupRequest request)
  48. {
  49. return await appHomePageService.MediaCathedraResult(request);
  50. }
  51. /// <summary>
  52. /// 每日好文
  53. /// </summary>
  54. /// <param name="request"></param>
  55. /// <returns></returns>
  56. [HttpPost("day-good-text")]
  57. [AllowAnonymous]
  58. public async Task<PagedList<MediaCathedraResult>> GetDayGoodTextAsync(MediaSearchRequest request)
  59. {
  60. request.MediaType = GxPress.EnumConst.AllTypeConst.Article.GetHashCode();
  61. request.IsDelete = 0;
  62. request.IsChecked = 1;
  63. return await appHomePageService.GetDayGoodTextAsync(request);
  64. }
  65. /// <summary>
  66. /// 信源听说
  67. /// </summary>
  68. /// <param name="request"></param>
  69. /// <returns></returns>
  70. [HttpPost("chat-hear-speak")]
  71. [AllowAnonymous]
  72. public async Task<PagedList<MediaCathedraResult>> GetChatHearSpeak(MediaSearchRequest request)
  73. {
  74. request.MediaType = GxPress.EnumConst.AllTypeConst.Audio.GetHashCode();
  75. request.IsDelete = 0;
  76. request.IsChecked = 1;
  77. return await appHomePageService.GetDayGoodTextAsync(request);
  78. }
  79. /// <summary>
  80. /// 根据标签ID获取每日好书
  81. /// </summary>
  82. /// <returns></returns>
  83. [HttpPost("lable")]
  84. [AllowAnonymous]
  85. public async Task<PagedList<MediaCathedraResult>> GetMediaByLableIdsAsync(MediaIdsRequest request)
  86. {
  87. return await appHomePageService.GetMediaByLableIdsAsync(request);
  88. }
  89. /// <summary>
  90. /// 名师
  91. /// </summary>
  92. /// <param name="request"></param>
  93. /// <returns></returns>
  94. [HttpPost("teacher")]
  95. [AllowAnonymous]
  96. public async Task<PagedList<TeacherResult>> GetTeacherAsync(TeacherRequest request)
  97. {
  98. return await appHomePageService.GetTeacherAsync(request);
  99. }
  100. }
  101. }