feat: 添加等级名称显示

This commit is contained in:
陈淳
2024-01-29 11:20:40 +08:00
parent 6bc9f1c7fd
commit fd78b2e3c3
11 changed files with 138 additions and 38 deletions

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using TencentCloud.Pds.V20210701.Models;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.EventBus.Local;
@@ -32,12 +33,14 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
IDiscussService
{
private ISqlSugarRepository<DiscussTopEntity> _discussTopEntityRepository;
public DiscussService(ForumManager forumManager, ISqlSugarRepository<DiscussTopEntity> discussTopEntityRepository, ISqlSugarRepository<PlateEntity> plateEntityRepository, ILocalEventBus localEventBus) : base(forumManager._discussRepository)
private BbsUserManager _bbsUserManager;
public DiscussService(BbsUserManager bbsUserManager, ForumManager forumManager, ISqlSugarRepository<DiscussTopEntity> discussTopEntityRepository, ISqlSugarRepository<PlateEntity> plateEntityRepository, ILocalEventBus localEventBus) : base(forumManager._discussRepository)
{
_forumManager = forumManager;
_plateEntityRepository = plateEntityRepository;
_localEventBus = localEventBus;
_discussTopEntityRepository = discussTopEntityRepository;
_bbsUserManager=bbsUserManager;
}
private readonly ILocalEventBus _localEventBus;
private ForumManager _forumManager { get; set; }
@@ -143,6 +146,8 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
//查询完主题之后,要过滤一下私有的主题信息
items.ApplyPermissionTypeFilter(CurrentUser.Id ?? Guid.Empty);
items?.ForEach(x => x.User.LevelName = _bbsUserManager._levelCacheDic[x.User.Level].Name);
return new PagedResultDto<DiscussGetListOutputDto>(total, items);
}
@@ -178,11 +183,11 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
Remark = user.Remark,
UserLimit = info.UserLimit,
Money = info.Money,
Experience = info.Experience
Experience = info.Experience,
}
}, true)
.ToListAsync();
output?.ForEach(x => x.User.LevelName = _bbsUserManager._levelCacheDic[x.User.Level].Name);
return output;
}