Merge branch 'refs/heads/abp' into digital-collectibles
This commit is contained in:
@@ -76,7 +76,6 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
|
||||
|
||||
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
|
||||
//var result = entities.Tile();
|
||||
var items = entities.Adapt<List<ArticleAllOutputDto>>();
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
.Select((discuss, user, info, plate) => new DiscussGetOutputDto
|
||||
{
|
||||
Id = discuss.Id,
|
||||
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().WhereIF(CurrentUser.Id != null,
|
||||
x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(),
|
||||
IsAgree = false,
|
||||
User = new BbsUserGetListOutputDto()
|
||||
{
|
||||
UserName = user.UserName,
|
||||
@@ -94,15 +93,25 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
||||
Logo = plate.Logo
|
||||
}
|
||||
}, true)
|
||||
.SingleAsync(discuss => discuss.Id == id);
|
||||
.FirstAsync(discuss => discuss.Id == id);
|
||||
|
||||
if (item is not null)
|
||||
if (item is null)
|
||||
{
|
||||
await VerifyDiscussPermissionAsync(item.Id);
|
||||
await _localEventBus.PublishAsync(new SeeDiscussEventArgs
|
||||
{ DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
||||
throw new UserFriendlyException("该主题不存在", "404");
|
||||
}
|
||||
|
||||
|
||||
//组装点赞
|
||||
var agreeCreatorList =
|
||||
(await _agreeRepository._DbQueryable.Where(x => x.DiscussId == item.Id).Select(x=>x.CreatorId).ToListAsync());
|
||||
//已登录
|
||||
if (CurrentUser.Id is not null)
|
||||
{
|
||||
item.IsAgree = agreeCreatorList.Contains(CurrentUser.Id);
|
||||
}
|
||||
|
||||
await VerifyDiscussPermissionAsync(item.Id);
|
||||
await _localEventBus.PublishAsync(new SeeDiscussEventArgs
|
||||
{ DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user