using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Common.Page;
using GxPress.Request.ArticleGroup;
using GxPress.Request.Media;
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
{
///
/// App首页数据
///
[Route("api/app/page")]
[ApiController]
[Authorize]
public class AppPageController : Controller
{
private readonly IAppHomePageService appHomePageService;
public AppPageController(IAppHomePageService appHomePageService)
{
this.appHomePageService = appHomePageService;
}
///
/// 大咖讲座
///
///
///
[HttpPost("cathedra")]
[AllowAnonymous]
public async Task>> GetMediasByTeacherAsync(ArticleGroupRequest request)
{
if (string.IsNullOrEmpty(request.StyleCss))
throw new Common.Exceptions.BusinessException("样式未知!");
return await appHomePageService.GetMediasByTeacherAsync(request);
}
///
/// 大咖讲座分页接口
///
///
[HttpPost("cathedra-page")]
[AllowAnonymous]
public async Task> MediaCathedraResult(ArticleGroupRequest request)
{
return await appHomePageService.MediaCathedraResult(request);
}
///
/// 每日好文
///
///
///
[HttpPost("day-good-text")]
[AllowAnonymous]
public async Task> GetDayGoodTextAsync(MediaSearchRequest request)
{
request.MediaType = GxPress.EnumConst.AllTypeConst.Article.GetHashCode();
return await appHomePageService.GetDayGoodTextAsync(request);
}
///
/// 信源听说
///
///
///
[HttpPost("chat-hear-speak")]
[AllowAnonymous]
public async Task> GetChatHearSpeak(MediaSearchRequest request)
{
request.MediaType = GxPress.EnumConst.AllTypeConst.Audio.GetHashCode();
return await appHomePageService.GetDayGoodTextAsync(request);
}
///
/// 根据标签ID获取每日好书
///
///
[HttpPost("lable")]
public async Task> GetMediaByLableIdsAsync(MediaIdsRequest request)
{
return await appHomePageService.GetMediaByLableIdsAsync(request);
}
}
}