李昊 4 years ago
parent
commit
a773d0d56b

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

@@ -90,6 +90,7 @@ namespace GxPress.Repository.Implement.SystemLabel
         {
             return await _repository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), ids));
         }
+        
 
     }
 }

+ 2 - 3
gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/MiddleLableService.cs

@@ -110,9 +110,9 @@ namespace GxPress.Service.Implement.Navigation
             middleLableResult.MiddleLableNexusResults = new List<MiddleLableNexusResult>();
             var middleLableNexusList = await middleLableNexusRepository.GetAllTaskAsync(middleLableId);
             var systemLabels = await systemLabelRepository.GetAllAsync(middleLableNexusList.Select(n => n.LableId).ToList());
-            foreach (var item in systemLabels)
+            foreach (var middleLableNexus in middleLableNexusList)
             {
-                foreach (var middleLableNexus in middleLableNexusList)
+                foreach (var item in systemLabels)
                 {
                     if (middleLableNexus.LableId == item.Id)
                     {
@@ -127,7 +127,6 @@ namespace GxPress.Service.Implement.Navigation
                         middleLableResult.MiddleLableNexusResults.Add(middleLableNexusResult);
                     }
                 }
-
             }
             return middleLableResult;
         }

+ 45 - 39
gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/NavigationService.cs

@@ -67,53 +67,59 @@ namespace GxPress.Service.Implement.Navigation
                     }
                 }
                 //获取标签
-                var systemLabels = await _systemLabelRepository.GetAllAsync(middleLableNexusIds.Select(n=>n.LableId).ToList());
-                foreach (var item in systemLabels)
+                var systemLabels = await _systemLabelRepository.GetAllAsync(middleLableNexusIds.Select(n => n.LableId).ToList());
+                foreach (var middleLableNexus in middleLableNexusIds)
                 {
-                    //获取常规数据
-                    var navigationLabelMediaResult = new NavigationLabelMediaResult()
+                    foreach (var item in systemLabels)
                     {
-                        Id = item.Id,
-                        Sort = item.Sort,
-                        StyleType = item.StyleType,
-                        ActionUrl = item.ActionUrl,
-                        ControllerUrl = item.ControllerUrl,
-                        IsPage = item.IsPage,
-                        IsSkip = item.IsSkip,
-                        LabelName = item.LabelName,
-                        ResourceType = item.ResourceType,
-                        LabelNameDescribe = item.LabelNameDescribe,
-                        Remark = item.Remark,
-                        IsShowLabelName = item.IsShowLabelName
-                    };
-                    // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160),170 直播 180 名师
-                    var specialInts = systemLabels.Where(n => n.ResourceType >= 130).Select(n => n.ResourceType);
-                    if (specialInts.Contains(item.ResourceType))
-                    {
-                        //获取特殊
-                        navigationLabelMediaResult.IsSpecial = true;
-                        //名师
-                        if (item.ResourceType == SpecialConst.Teacher.GetHashCode())
+                        if (middleLableNexus.LableId != item.Id)
+                            continue;
+                        //获取常规数据
+                        var navigationLabelMediaResult = new NavigationLabelMediaResult()
+                        {
+                            Id = item.Id,
+                            Sort = item.Sort,
+                            StyleType = item.StyleType,
+                            ActionUrl = item.ActionUrl,
+                            ControllerUrl = item.ControllerUrl,
+                            IsPage = item.IsPage,
+                            IsSkip = item.IsSkip,
+                            LabelName = item.LabelName,
+                            ResourceType = item.ResourceType,
+                            LabelNameDescribe = item.LabelNameDescribe,
+                            Remark = item.Remark,
+                            IsShowLabelName = item.IsShowLabelName
+                        };
+                        // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160),170 直播 180 名师
+                        var specialInts = systemLabels.Where(n => n.ResourceType >= 130).Select(n => n.ResourceType);
+                        if (specialInts.Contains(item.ResourceType))
                         {
-                            navigationLabelMediaResult.IsTeacher = true;
-                            navigationLabelMediaResult.TeacherResults = await teacherRepository.GetTeacherResult();
+                            //获取特殊
+                            navigationLabelMediaResult.IsSpecial = true;
+                            //名师
+                            if (item.ResourceType == SpecialConst.Teacher.GetHashCode())
+                            {
+                                navigationLabelMediaResult.IsTeacher = true;
+                                navigationLabelMediaResult.TeacherResults = await teacherRepository.GetTeacherResult();
+                                result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
+                                continue;
+                            }
+                            navigationLabelMediaResult.SpecialLabelResults = await specialLabelRepository.GetAllAsync(item.ResourceType);
+                            foreach (var specialLabelResult in navigationLabelMediaResult.SpecialLabelResults)
+                                specialLabelResult.ImageUrls = StringUtils.AddDomain(specialLabelResult.ImageUrls);
                             result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
                             continue;
                         }
-                        navigationLabelMediaResult.SpecialLabelResults = await specialLabelRepository.GetAllAsync(item.ResourceType);
-                        foreach (var specialLabelResult in navigationLabelMediaResult.SpecialLabelResults)
-                            specialLabelResult.ImageUrls = StringUtils.AddDomain(specialLabelResult.ImageUrls);
+                        //获取媒体标签
+                        var mediaIds = await _mediaLableRepository.GetMediaIdsAysnc(item.Id);
+                        var medias = await _mediaRepository.GetNavigationMediaResults(mediaIds);
+                        navigationLabelMediaResult.MediaResults = medias.ToList();
+                        foreach (var itemMedia in navigationLabelMediaResult.MediaResults)
+                            itemMedia.ImageUrls = StringUtils.AddDomain(itemMedia.ImageUrls);
                         result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
-                        continue;
                     }
-                    //获取媒体标签
-                    var mediaIds = await _mediaLableRepository.GetMediaIdsAysnc(item.Id);
-                    var medias = await _mediaRepository.GetNavigationMediaResults(mediaIds);
-                    navigationLabelMediaResult.MediaResults = medias.ToList();
-                    foreach (var itemMedia in navigationLabelMediaResult.MediaResults)
-                        itemMedia.ImageUrls = StringUtils.AddDomain(itemMedia.ImageUrls);
-                    result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
                 }
+
             }
             return result;
         }
@@ -141,7 +147,7 @@ namespace GxPress.Service.Implement.Navigation
                 }
             }
             //获取标签
-            var systemLabels = await _systemLabelRepository.GetAllAsync(middleLableNexusIds.Select(n=>n.LableId).ToList());
+            var systemLabels = await _systemLabelRepository.GetAllAsync(middleLableNexusIds.Select(n => n.LableId).ToList());
             foreach (var item in systemLabels)
             {
                 //获取常规数据