You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
3 months ago
|
using AutoMapper;
|
||
|
using Kean.Application.Query.Interfaces;
|
||
|
using Kean.Application.Query.ViewModels;
|
||
|
using Kean.Infrastructure.Database.Repository.Default.Entities;
|
||
|
using Kean.Infrastructure.NoSql.Repository.Default;
|
||
|
using Kean.Infrastructure.Utilities;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Kean.Application.Query.Implements
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 应用程序查询服务实现
|
||
|
/// </summary>
|
||
|
public class AppService : IAppService
|
||
|
{
|
||
|
private readonly IMapper _mapper; // 模型映射
|
||
|
private readonly IDefaultRedis _redis; // 默认 Redis
|
||
|
|
||
|
/// <summary>
|
||
|
/// 依赖注入
|
||
|
/// </summary>
|
||
|
public AppService(
|
||
|
IMapper mapper,
|
||
|
IDefaultRedis redis)
|
||
|
{
|
||
|
_mapper = mapper;
|
||
|
_redis = redis;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* 实现 Kean.Application.Query.Interfaces.IAppService.GetBlacklist(string address) 方法
|
||
|
*/
|
||
|
public async Task<Blacklist> GetBlacklist(string address)
|
||
|
{
|
||
|
var cache = await _redis.Hash["blacklist"].Get(address);
|
||
|
var entity = cache == null ? null : JsonHelper.Deserialize<T_SYS_SECURITY>(cache);
|
||
|
return _mapper.Map<Blacklist>(entity);
|
||
|
}
|
||
|
}
|
||
|
}
|