43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using StackExchange.Redis;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hg.Core.Domain
|
|
{
|
|
internal class CustomerDomain : ICustomerDomain
|
|
{
|
|
private readonly IConfiguration _configuration;
|
|
private readonly IHttpClient _httpClient;
|
|
private readonly IBaseRepository<CrmDbContext> _crmRepository;
|
|
private readonly IBaseRepository<ZxdDbContext> _zxdRepository;
|
|
private readonly ICacheDomain _cacheDomain;
|
|
private readonly SystemConfig _systemConfig;
|
|
|
|
public CustomerDomain(IConfiguration configuration,
|
|
IHttpClient httpClient,
|
|
IBaseRepository<CrmDbContext> crmRepository,
|
|
IBaseRepository<ZxdDbContext> zxdRepository,
|
|
ICacheDomain cacheDomain)
|
|
{
|
|
_systemConfig = configuration.GetSection("SystemConfig").Get<SystemConfig>();
|
|
_configuration = configuration;
|
|
_httpClient = httpClient;
|
|
_crmRepository = crmRepository;
|
|
_zxdRepository = zxdRepository;
|
|
_cacheDomain = cacheDomain;
|
|
}
|
|
|
|
public async Task<string?> GetUsername(string? softname)
|
|
{
|
|
var data = await _crmRepository.GetRepository<TraceUser>().Query()
|
|
.Where(x => softname == x.Uid)
|
|
.OrderByDescending(x => x.Ctime)
|
|
.Select(x => x.Username).FirstOrDefaultAsync();
|
|
return data;
|
|
}
|
|
}
|
|
}
|