fix: 修复文章导入方式
This commit is contained in:
@@ -33,6 +33,11 @@ namespace Yi.Framework.Bbs.Domain.Entities
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
}
|
||||
|
||||
public static class ArticleEntityExtensions
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Model;
|
||||
using Yi.Framework.Core.Data;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
|
||||
{
|
||||
@@ -19,10 +20,12 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
|
||||
public virtual List<ArticleEntity> Import(Guid discussId, Guid articleParentId, List<FileObject> fileObjs)
|
||||
{
|
||||
var articles = Convert(fileObjs);
|
||||
var orderNum = 0;
|
||||
articles.ForEach(article =>
|
||||
{
|
||||
article.DiscussId = discussId;
|
||||
article.ParentId = articleParentId;
|
||||
article.OrderNum = ++orderNum;
|
||||
});
|
||||
return articles;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport
|
||||
f.Content = result;
|
||||
return f;
|
||||
});
|
||||
|
||||
var output = fileContentHandler.Select(x => new ArticleEntity() { Content = x.Content, Name = x.FileName }).ToList();
|
||||
|
||||
return output;
|
||||
|
||||
Reference in New Issue
Block a user