李昊 4 years ago
parent
commit
0800c9d10f

+ 0 - 6
gx_api/GxPress/Model/GxPress.Result/Media/BookMediaResult.cs

@@ -156,12 +156,6 @@ namespace GxPress.Result.Media
         /// <value></value>
         public string CatalogId { get; set; }
         /// <summary>
-        /// 
-        /// </summary>
-        /// <value></value>
-        public int ParentId { get; set; }
-
-        /// <summary>
         /// 是否可阅读
         /// </summary>
         /// <value></value>

+ 6 - 6
gx_api/GxPress/Service/GxPress.Service.Implement/Epub/EpubService.cs

@@ -48,13 +48,13 @@ namespace GxPress.Service.Implement.Epub
                 bookCatalog.Children = new List<BookCatalogResult>();
                 foreach (var item in subChapters)
                 {
+                    var bookCatalogModel = new BookCatalogResult();
+                    bookCatalogModel.Children = new List<BookCatalogResult>();
                     i++;
-                    bookCatalog = new BookCatalogResult();
-                    bookCatalog.Id = i;
-                    bookCatalog.CatalogNameg = item.Title;
-                    bookCatalog.CatalogId = item.HtmlContentFile.FileName;
-                    bookCatalog.ParentId = i;
-                    bookCatalog.Children.Add(bookCatalog);
+                    bookCatalogModel.Id = i;
+                    bookCatalogModel.CatalogNameg = item.Title;
+                    bookCatalogModel.CatalogId = item.HtmlContentFile.FileName;
+                    bookCatalog.Children.Add(bookCatalogModel);
                 }
                 i++;
             }

+ 12 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Media/MediaService.cs

@@ -107,12 +107,24 @@ namespace GxPress.Service.Implement.Media
                 {
                     if (item.Id <= sectionValue)
                         item.IsRead = true;
+                    if (item.IsChildren)
+                    {
+                        foreach (var bookCatalogResult in item.Children)
+                        {
+                            if (bookCatalogResult.Id <= sectionValue)
+                                bookCatalogResult.IsRead = true;
+                        }
+                    }
                 }
             }
             else
             {
                 foreach (var item in result.BookCatalogResults)
+                {
                     item.IsRead = true;
+                    foreach (var bookCatalogResult in item.Children)
+                        bookCatalogResult.IsRead = true;
+                }
             }
             //计算免费占比
             return result;