using System.Collections.Generic; using System.Threading.Tasks; using GxPress.Common.Page; using GxPress.Request.ArticleGroup; using GxPress.Result.Media; using GxPress.Result.SystemLabel; using GxPress.Service.Interface.AppHomePage; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AppControllers { /// <summary> /// App首页数据 /// </summary> [Route("api/app/page")] [ApiController] [Authorize] public class AppPageController : Controller { private readonly IAppHomePageService appHomePageService; public AppPageController(IAppHomePageService appHomePageService) { this.appHomePageService = appHomePageService; } /// <summary> /// 大咖讲座 /// </summary> /// <param name="request"></param> /// <returns></returns> [HttpPost("cathedra")] [AllowAnonymous] public async Task<List<AppLabelResult<MediaCathedraResult>>> GetMediasByTeacherAsync(ArticleGroupRequest request) { if (string.IsNullOrEmpty(request.StyleCss)) throw new Common.Exceptions.BusinessException("样式未知!"); return await appHomePageService.GetMediasByTeacherAsync(request); } /// <summary> /// 大咖讲座分页接口 /// </summary> /// <returns></returns> [HttpPost("cathedra-page")] [AllowAnonymous] public async Task<PagedList<MediaCathedraResult>> MediaCathedraResult(ArticleGroupRequest request) { return await appHomePageService.MediaCathedraResult(request); } } }