feat: 完成评论功能

This commit is contained in:
橙子
2023-03-23 23:12:26 +08:00
parent 4babe3e05d
commit 84ec0a7e1c
7 changed files with 162 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class CommentGetListInputVo
{
public DateTime? CreateTime { get; set; }
public DateTime? creationTime { get; set; }
public string? Content { get; set; }
//Ӧ<><D3A6>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ī<EFBFBD><C4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ

View File

@@ -16,7 +16,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public long Id { get; set; }
public DateTime? CreateTime { get; set; }
public DateTime? CreationTime { get; set; }
public string Content { get; set; }

View File

@@ -50,7 +50,7 @@ namespace Yi.BBS.Application.Forum
.ToListAsync();
//结果初始值,第一层等于全部根节点
var outPut = entities.Where(x => x.ParentId == 0).ToList();
var outPut = entities.Where(x => x.ParentId == 0).OrderByDescending(x=>x.CreationTime).ToList();
//将全部数据进行hash
var dic = entities.ToDictionary(x => x.Id);
@@ -73,9 +73,17 @@ namespace Yi.BBS.Application.Forum
}
}
//子类需要排序
outPut.ForEach(x =>
{
x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList();
});
//获取全量主题评论, 先获取顶级的,将其他子组合到顶级下,形成一个二维,先转成dto
List<CommentGetListOutputDto>? items = await MapToGetListOutputDtosAsync(outPut);
return new PagedResultDto<CommentGetListOutputDto>(0, items);
return new PagedResultDto<CommentGetListOutputDto>(entities.Count(), items);
}