lihao пре 4 година
родитељ
комит
67b67a913a
1 измењених фајлова са 15 додато и 4 уклоњено
  1. 15 4
      gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

+ 15 - 4
gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

@@ -608,14 +608,24 @@ namespace GxPress.Service.Implement.Note
                 throw new BusinessException("标题和内容至少一项必填!");
             if (!string.IsNullOrWhiteSpace(note.Content))
             {
+                entity.TextContent = string.Empty;
                 var json = JsonConvert.DeserializeObject<List<ContentJsonData>>(note.Content);
                 foreach (var item in json)
+                {
                     item.File = StringUtils.RemoveDomain(item.File);
+                    if (item.Type == AllTypeConst.Text.GetHashCode())
+                        entity.TextContent += item.Text;
+                }
                 entity.Content = JsonConvert.SerializeObject(json);
-                entity.HtmlContent = note.HtmlContent;
+                entity.TextContent = note.TextContent;
+
             }
             else
-                entity.Content = "";
+            {
+                entity.Content = string.Empty;
+                entity.HtmlContent = string.Empty;
+                entity.TextContent = string.Empty;
+            }
             if (note.FolderId > 0)
             {
                 entity.FolderId = note.FolderId;
@@ -824,8 +834,9 @@ namespace GxPress.Service.Implement.Note
                     }
                     if (!string.IsNullOrEmpty(item.TextContent))
                         await _noteRepository.UpdateAsync(item);
-                    else{
-                        item.TextContent="[]";
+                    else
+                    {
+                        item.TextContent = "[]";
                         await _noteRepository.UpdateAsync(item);
                     }
                 }