李昊 il y a 4 ans
Parent
commit
50547d55c2

+ 5 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSystemLabelController.cs

@@ -21,6 +21,11 @@ namespace GxPress.Api.AdminControllers
         {
             _repository = repository;
         }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
         [HttpPost]
         public async Task<int> Insert(Entity.SystemLabel.SystemLabel note)
         {

+ 11 - 1
gx_api/GxPress/Api/GxPress.Api/WebControllers/NavigationController.cs

@@ -37,7 +37,7 @@ namespace GxPress.Api.WebControllers
         /// 获取中间页面数据
         /// </summary>
         /// <returns></returns>
-        [HttpGet("middle-lable/{id}")]
+        [HttpGet("middle-lable/{middleLableId}")]
         [AllowAnonymous]
         public async Task<MiddleLableResult> GetMiddleLableResults(int middleLableId)
         {
@@ -54,5 +54,15 @@ namespace GxPress.Api.WebControllers
         {
             return await navigationRepository.GetAllAsync(terminal);
         }
+        /// <summary>
+        /// 标签查询数据
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("label/{labelId}")]
+        [AllowAnonymous]
+        public async Task<LabelMediaResult> GetLabelMediaResult(int labelId)
+        {
+            return await navigationService.GetLabelMediaResult(labelId);
+        }
     }
 }

+ 7 - 1
gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SystemLabel.cs

@@ -21,7 +21,7 @@ namespace GxPress.Entity.SystemLabel
         /// <value></value>
         [DataColumn]
         public string LabelNameDescribe { get; set; }
-         /// <summary>
+        /// <summary>
         /// 备注
         /// </summary>
         /// <value></value>
@@ -80,5 +80,11 @@ namespace GxPress.Entity.SystemLabel
         /// <value></value>
         [DataColumn]
         public string StyleType { get; set; }
+        /// <summary>
+        /// 是否显示标签名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsShowLabelName { get; set; }
     }
 }

+ 5 - 0
gx_api/GxPress/Model/GxPress.Request/SystemLabel/SystemLabelRequest.cs

@@ -86,5 +86,10 @@ namespace GxPress.Request.SystemLabel
         /// <value></value>
 
         public string StyleType { get; set; }
+         /// <summary>
+        /// 是否显示标签名称 1 设置 2取消
+        /// </summary>
+        /// <value></value>
+        public int IsShowLabelName { get; set; }
     }
 }

+ 26 - 5
gx_api/GxPress/Model/GxPress.Result/Navigation/NavigationResult.cs

@@ -94,6 +94,11 @@ namespace GxPress.Result.Navigation
         /// </summary>
         /// <value></value>
         public bool IsSpecial { get; set; }
+        /// <summary>
+        /// 是否显示标签名称
+        /// </summary>
+        /// <value></value>
+        public bool IsShowLabelName { get; set; }
     }
     /// <summary>
     /// 中间页面
@@ -153,11 +158,6 @@ namespace GxPress.Result.Navigation
         /// </summary>
         /// <value></value>
         public IEnumerable<Entity.Slide> Sildes { get; set; }
-        /// <summary>
-        /// 是否特殊
-        /// </summary>
-        /// <value></value>
-        public bool IsSpecial { get; set; }
     }
     /// <summary>
     /// 导航数据的显示
@@ -234,4 +234,25 @@ namespace GxPress.Result.Navigation
         public string ActionUrl { get; set; }
 
     }
+    /// <summary>
+    /// 标签查询数据
+    /// </summary>
+    public class LabelMediaResult
+    {
+        /// <summary>
+        /// 标签查询数据
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<NavigationMediaResult> LabelMediaResults { get; set; }
+        /// <summary>
+        /// 猜你喜欢
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<NavigationMediaResult> LikeMediaResults { get; set; }
+        /// <summary>
+        /// 推荐
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<NavigationMediaResult> RecommendMediaResults { get; set; }
+    }
 }

+ 50 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -386,5 +386,55 @@ namespace GxPress.Repository.Implement.Media
             query.ForPage(1, 10);
             return await _repository.GetAllAsync<NavigationMediaResult>(query);
         }
+        /// <summary>
+        /// 猜你喜欢
+        /// </summary>
+        /// <param name="mediaIds"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<NavigationMediaResult>> GetlikeMediaResults()
+        {
+            //获取媒体
+            var query = Q.NewQuery();
+            query.Select(nameof(Entity.tede2.Media.Media.Id));
+            query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
+            query.Select(nameof(Entity.tede2.Media.Media.Title));
+            query.Select(nameof(Entity.tede2.Media.Media.Summary));
+            query.Select(nameof(Entity.tede2.Media.Media.TeacherId));
+            query.Select(nameof(Entity.tede2.Media.Media.AutoNumber));
+            query.Select(nameof(Entity.tede2.Media.Media.Author));
+            query.Select(nameof(Entity.tede2.Media.Media.MediaType));
+            query.Where(nameof(Entity.tede2.Media.Media.IsTop), true);
+            query.Where(nameof(Entity.tede2.Media.Media.IsChecked), true);
+            query.Where(nameof(Entity.tede2.Media.Media.IsDelete), false);
+            query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
+            query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
+            query.ForPage(1, 10);
+            return await _repository.GetAllAsync<NavigationMediaResult>(query);
+        }
+        /// <summary>
+        /// 推荐
+        /// </summary>
+        /// <param name="mediaIds"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<NavigationMediaResult>> GetRecommendMediaResults()
+        {
+            //获取媒体
+            var query = Q.NewQuery();
+            query.Select(nameof(Entity.tede2.Media.Media.Id));
+            query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
+            query.Select(nameof(Entity.tede2.Media.Media.Title));
+            query.Select(nameof(Entity.tede2.Media.Media.Summary));
+            query.Select(nameof(Entity.tede2.Media.Media.TeacherId));
+            query.Select(nameof(Entity.tede2.Media.Media.AutoNumber));
+            query.Select(nameof(Entity.tede2.Media.Media.Author));
+            query.Select(nameof(Entity.tede2.Media.Media.MediaType));
+            query.Where(nameof(Entity.tede2.Media.Media.IsRecommend), true);
+            query.Where(nameof(Entity.tede2.Media.Media.IsChecked), true);
+            query.Where(nameof(Entity.tede2.Media.Media.IsDelete), false);
+            query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
+            query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
+            query.ForPage(1, 10);
+            return await _repository.GetAllAsync<NavigationMediaResult>(query);
+        }
     }
 }

+ 2 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLabelRepository.cs

@@ -69,6 +69,8 @@ namespace GxPress.Repository.Implement.SystemLabel
                     model.Sort = request.Sort;
                 if (!string.IsNullOrEmpty(request.StyleType))
                     model.StyleType = request.StyleType;
+                if (request.IsShowLabelName > 0)
+                    model.IsShowLabelName = request.IsShowLabelName == 1;
                 return await _repository.UpdateAsync(model);
             }
             return false;

+ 12 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Media/IMediaRepository.cs

@@ -43,5 +43,17 @@ namespace GxPress.Repository.Interface.Media
         /// <returns></returns>
         Task<VideoMediaResult> GetVideoMediaResultAsync(int mediaId);
         Task<IEnumerable<NavigationMediaResult>> GetNavigationMediaResults(IEnumerable<int> mediaLables);
+        /// <summary>
+        /// 猜你喜欢
+        /// </summary>
+        /// <param name="mediaIds"></param>
+        /// <returns></returns>
+        Task<IEnumerable<NavigationMediaResult>> GetlikeMediaResults();
+        /// <summary>
+        /// 推荐
+        /// </summary>
+        /// <param name="mediaIds"></param>
+        /// <returns></returns>
+        Task<IEnumerable<NavigationMediaResult>> GetRecommendMediaResults();
     }
 }

+ 17 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/NavigationService.cs

@@ -78,7 +78,8 @@ namespace GxPress.Service.Implement.Navigation
                         LabelName = item.LabelName,
                         ResourceType = item.ResourceType,
                         LabelNameDescribe = item.LabelNameDescribe,
-                        Remark = item.Remark
+                        Remark = item.Remark,
+                        IsShowLabelName = item.IsShowLabelName
                     };
                     // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160)
                     var specialInts = systemLabels.Where(n => n.ResourceType >= 130).Select(n => n.ResourceType);
@@ -168,5 +169,20 @@ namespace GxPress.Service.Implement.Navigation
             }
             return result;
         }
+        /// <summary>
+        /// 获取标签数据
+        /// </summary>
+        /// <param name="labelId"></param>
+        /// <returns></returns>
+        public async Task<LabelMediaResult> GetLabelMediaResult(int labelId)
+        {
+            var result = new LabelMediaResult();
+            //获取媒体标签
+            var mediaIds = await _mediaLableRepository.GetMediaIdsAysnc(labelId);
+            result.LabelMediaResults = await _mediaRepository.GetNavigationMediaResults(mediaIds);
+            result.LikeMediaResults = await _mediaRepository.GetlikeMediaResults();
+            result.RecommendMediaResults = await _mediaRepository.GetRecommendMediaResults();
+            return result;
+        }
     }
 }

+ 6 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Navigation/INavigationService.cs

@@ -15,5 +15,11 @@ namespace GxPress.Service.Interface.Navigation
         /// </summary>
         /// <returns></returns>
         Task<MiddleLableResult> GetMiddleLableResults(int middleLableId);
+        /// <summary>
+        /// 获取标签数据
+        /// </summary>
+        /// <param name="labelId"></param>
+        /// <returns></returns>
+        Task<LabelMediaResult> GetLabelMediaResult(int labelId);
     }
 }