|
@@ -0,0 +1,51 @@
|
|
|
+using GxPress.Service.Interface.AppHomePage;
|
|
|
+using GxPress.Repository.Interface;
|
|
|
+using GxPress.Repository.Interface.Media;
|
|
|
+using GxPress.Request.ArticleGroup;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Collections.Generic;
|
|
|
+using GxPress.Result.SystemLabel;
|
|
|
+using GxPress.Result.Media;
|
|
|
+
|
|
|
+namespace GxPress.Service.Implement.AppHomePage
|
|
|
+{
|
|
|
+ public class AppHomePageService : IAppHomePageService
|
|
|
+ {
|
|
|
+ private readonly IArticleGroupRepository articleGroupRepository;
|
|
|
+ private readonly IMediaRepository mediaRepository;
|
|
|
+ public AppHomePageService(IArticleGroupRepository articleGroupRepository, IMediaRepository mediaRepository)
|
|
|
+ {
|
|
|
+ this.articleGroupRepository = articleGroupRepository;
|
|
|
+ this.mediaRepository = mediaRepository;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 大咖讲座
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<AppLabelResult<MediaCathedraResult>>> GetMediasByTeacherAsync(ArticleGroupRequest request)
|
|
|
+ {
|
|
|
+ var results = new List<AppLabelResult<MediaCathedraResult>>();
|
|
|
+ request.Sort = "recommend";
|
|
|
+ var items = await mediaRepository.GetMediasByTeacherAsync(request);
|
|
|
+ results.Add(new AppLabelResult<MediaCathedraResult>() { LabelName = "今日推荐", IsPage = false, ResourceType = 40, Method = "", Items = items });
|
|
|
+ request.Sort = "";
|
|
|
+ items = await mediaRepository.GetMediasByTeacherAsync(request);
|
|
|
+ results.Add(new AppLabelResult<MediaCathedraResult>() { LabelName = "更多精彩", IsPage = true, ResourceType = 40, Method = "post", Items = items, ActionUrl = "api/app/page/cathedra-page" });
|
|
|
+ foreach (var item in results)
|
|
|
+ {
|
|
|
+ foreach (var model in item.Items)
|
|
|
+ model.Duration = "02:19:20";
|
|
|
+ }
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 大咖讲座
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<MediaCathedraResult>> MediaCathedraResult(ArticleGroupRequest request)
|
|
|
+ {
|
|
|
+ return await mediaRepository.GetMediasByTeacherAsync(request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|