feat: 添加等级名称显示
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
using Volo.Abp.Modularity;
|
||||
using System.Collections.Generic;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Framework.Bbs.Domain.Entities.Integral;
|
||||
using Yi.Framework.Bbs.Domain.Shared;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Caches;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Consts;
|
||||
using Yi.Framework.Rbac.Domain;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain
|
||||
@@ -11,6 +20,14 @@ namespace Yi.Framework.Bbs.Domain
|
||||
)]
|
||||
public class YiFrameworkBbsDomainModule : AbpModule
|
||||
{
|
||||
|
||||
public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
|
||||
{
|
||||
//加载等级缓存
|
||||
var services = context.ServiceProvider;
|
||||
var levelRepository = services.GetRequiredService<IRepository<LevelEntity>>();
|
||||
var levelCache = services.GetRequiredService<IDistributedCache<List<LevelCacheItem>>>();
|
||||
var cacheItem = (await levelRepository.GetListAsync()).Adapt<List<LevelCacheItem>>();
|
||||
await levelCache.SetAsync(LevelConst.LevelCacheKey, cacheItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user