84 lines
3.3 KiB
C#
84 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Zxd.Core.Shared;
|
|
using Zxd.Entity.UserCenter;
|
|
|
|
namespace Zxd.Domain
|
|
{
|
|
public class UserInfoDomain : IUserInfoDomain
|
|
{
|
|
private readonly IHttpClient _httpClient;
|
|
private readonly SystemConfig _systemConfig;
|
|
|
|
public UserInfoDomain(
|
|
IConfiguration configuration, IHttpClient httpClient)
|
|
{
|
|
_systemConfig = configuration.GetSection("SystemConfig").Get<SystemConfig>();
|
|
_httpClient = httpClient;
|
|
}
|
|
|
|
/* public async Task<List<UserInfoDto>> GetUserInfo(string? appid, string? appuserid)
|
|
{
|
|
List<UserInfoDto> res = new List<UserInfoDto>();
|
|
var userinfos = await _userCenterRepository.GetRepository<UserInfo>().Query()
|
|
.Where(x => x.Appid == appid && x.Appuserid == appuserid)
|
|
.ToListAsync();
|
|
if (userinfos == null || !userinfos.Any())
|
|
{
|
|
return res;
|
|
}
|
|
var customerid = userinfos[0].Customerid;
|
|
userinfos = await _userCenterRepository.GetRepository<UserInfo>().Query()
|
|
.Where(x => x.Customerid == customerid)
|
|
.ToListAsync();
|
|
if (userinfos == null || !userinfos.Any())
|
|
{
|
|
return res;
|
|
}
|
|
foreach (var userinfo in userinfos)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(userinfo.Resid))
|
|
{
|
|
UserInfoDto newModel = new UserInfoDto
|
|
{
|
|
Resid = userinfo.Resid,
|
|
};
|
|
res.Add(newModel);
|
|
}
|
|
}
|
|
return res;
|
|
}*/
|
|
|
|
public async Task<List<UserInfoReq>> GetUserInfoByApi(string? appid, string? userid)
|
|
{
|
|
Stopwatch stopWatch = Stopwatch.StartNew();
|
|
stopWatch.Start();
|
|
var res = new List<UserInfoReq>();
|
|
var url = _systemConfig.ZXDCoreUrl; // _basParameterService.GetParameterValue("Zxd_CoreApiUrl");
|
|
url = $"{url}Api/UserInfo/list";
|
|
var resModel = await _httpClient.GetAsync<CommonApiResult<List<UserInfoReq>>>($"{url}?appid={appid}&appuserid={userid}", timeout: 2000);
|
|
res = resModel.data;
|
|
stopWatch.Stop();
|
|
Log.Warning($"GetUserInfoByApi:{stopWatch.ElapsedMilliseconds}");
|
|
return res;
|
|
}
|
|
|
|
public async Task<List<UserInfoReq>> GetUserInfoByApi(string? resid)
|
|
{
|
|
Stopwatch stopWatch = Stopwatch.StartNew();
|
|
stopWatch.Start();
|
|
var res = new List<UserInfoReq>();
|
|
var url = _systemConfig.ZXDCoreUrl; // _basParameterService.GetParameterValue("Zxd_CoreApiUrl");
|
|
url = $"{url}Api/UserInfo/list";
|
|
var resModel = await _httpClient.GetAsync<CommonApiResult<List<UserInfoReq>>>($"{url}?resid={resid}", timeout: 2000);
|
|
res = resModel.data;
|
|
stopWatch.Stop();
|
|
Log.Warning($"GetUserInfoByApi:{stopWatch.ElapsedMilliseconds}");
|
|
return res;
|
|
}
|
|
}
|
|
} |