李昊 преди 4 години
родител
ревизия
2cf7567c26

+ 25 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/AppPageController.cs

@@ -2,6 +2,7 @@ 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;
@@ -47,5 +48,29 @@ namespace GxPress.Api.AppControllers
         {
             return await appHomePageService.MediaCathedraResult(request);
         }
+        /// <summary>
+        /// 每日好文
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("day-good-text")]
+        [AllowAnonymous]
+        public async Task<PagedList<MediaCathedraResult>> GetDayGoodTextAsync(MediaSearchRequest request)
+        {
+            request.MediaType = GxPress.EnumConst.AllTypeConst.Article.GetHashCode();
+            return await appHomePageService.GetDayGoodTextAsync(request);
+        }
+        /// <summary>
+        /// 信源听说
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("chat-hear-speak")]
+        [AllowAnonymous]
+        public async Task<PagedList<MediaCathedraResult>> GetChatHearSpeak(MediaSearchRequest request)
+        {
+            request.MediaType = GxPress.EnumConst.AllTypeConst.Audio.GetHashCode();
+            return await appHomePageService.GetDayGoodTextAsync(request);
+        }
     }
 }

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/AppControllers/SlideController.cs

@@ -28,7 +28,7 @@ namespace GxPress.Api.AppControllers
         /// App列表
         /// </summary>
         /// <returns></returns>
-        [HttpGet("list")]
+        [HttpPost("list")]
         public async Task<PagedList<Slide>> GetList(SlideSearchRequest request)
         {
             request.TypeId=1;

+ 30 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/AppHomePage/AppHomePageService.cs

@@ -13,6 +13,7 @@ using AutoMapper;
 using System.Linq;
 using GxPress.Common.Tools;
 using GxPress.Common.Page;
+using GxPress.Request.Media;
 
 namespace GxPress.Service.Implement.AppHomePage
 {
@@ -63,10 +64,37 @@ namespace GxPress.Service.Implement.AppHomePage
             {
                 return await GetVipSupplyAsync(request);
             }
-            //
+
             return results;
         }
         /// <summary>
+        /// 每日好文
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<PagedList<MediaCathedraResult>> GetDayGoodTextAsync(MediaSearchRequest request)
+        {
+            var result = new PagedList<MediaCathedraResult>();
+            var model = await mediaRepository.GetAllAsync(request);
+            var list = new List<MediaCathedraResult>();
+            foreach (var item in model.Items)
+            {
+                var mediaCathedraResult = new MediaCathedraResult();
+                mediaCathedraResult.Author = item.Author;
+                mediaCathedraResult.CollectCount = item.CollectCount;
+                mediaCathedraResult.CreatedDate = item.CreatedDate;
+                mediaCathedraResult.Id = item.Id;
+                mediaCathedraResult.ImageUrls = item.ImageUrls;
+                mediaCathedraResult.MediaType = item.MediaType;
+                mediaCathedraResult.ReadCount = item.ReadCount;
+                mediaCathedraResult.Title = item.Title;
+                list.Add(mediaCathedraResult);
+            }
+            result.Total = model.Total;
+            result.Items = list;
+            return result;
+        }
+        /// <summary>
         /// 会员特供
         /// </summary>
         /// <param name="request"></param>
@@ -88,7 +116,7 @@ namespace GxPress.Service.Implement.AppHomePage
                 {
                     //获取媒体标签
                     var mediaIds = await _mediaLableRepository.GetMediaIdsAysnc(item.Id);
-                    var medias = await mediaRepository.GetNavigationMediaResults(mediaIds,item.PageSize);
+                    var medias = await mediaRepository.GetNavigationMediaResults(mediaIds, item.PageSize);
                     var list = new List<MediaCathedraResult>();
                     foreach (var mediaModel in medias)
                     {

+ 9 - 2
gx_api/GxPress/Service/GxPress.Service.Interface/AppHomePage/IAppHomePageService.cs

@@ -2,6 +2,7 @@ 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;
 
@@ -15,10 +16,16 @@ namespace GxPress.Service.Interface.AppHomePage
         /// <param name="request"></param>
         /// <returns></returns>
         Task<List<AppLabelResult<MediaCathedraResult>>> GetMediasByTeacherAsync(ArticleGroupRequest request);
-         /// <summary>
+        /// <summary>
         /// 大咖讲座分页
         /// </summary>
         /// <returns></returns>
-         Task<PagedList<MediaCathedraResult>> MediaCathedraResult(ArticleGroupRequest request);
+        Task<PagedList<MediaCathedraResult>> MediaCathedraResult(ArticleGroupRequest request);
+        /// <summary>
+        /// 每日好文
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        Task<PagedList<MediaCathedraResult>> GetDayGoodTextAsync(MediaSearchRequest request);
     }
 }