This commit is contained in:
2026-08-31 14:42:22 +08:00
72 changed files with 2479 additions and 168 deletions
@@ -27,7 +27,7 @@ namespace ContactService.WebApi.Application.IntegrationServices
{
Avatar = res.Avatar,
CreationTime = res.CreationTime.ToDateTimeOffset(),
Deletion = res.Deletion.ToDateTimeOffset(),
Deletion = res.Deletion != null ? res.Deletion.ToDateTimeOffset() : null,
Description = res.Description,
Email = res.Email,
Id = Guid.Parse(res.Id),
@@ -40,8 +40,40 @@ namespace ContactService.WebApi.Application.IntegrationServices
{
return Result.Fail<UserInfoDto>(ResultCode.USER_NOT_FOUND);
}
}
public async Task<Result<Dictionary<Guid, UserInfoDto>>> FindByIdsAsync(List<Guid> ids)
{
if (ids == null || ids.Count == 0)
return Result.Success(new Dictionary<Guid, UserInfoDto>());
var req = new GetUserListRequest();
req.UserIds.AddRange(ids.Select(x => x.ToString()));
try
{
var res = await client.GetUserListAsyncAsync(req);
var dict = res.Users.ToDictionary(
u => Guid.Parse(u.Id),
u => new UserInfoDto
{
Id = Guid.Parse(u.Id),
UserName = u.UserName,
NickName = u.NickName,
Email = u.Email,
Phone = u.Phone,
Region = u.Region,
Description = u.Description,
Avatar = u.Avatar,
CreationTime = u.CreationTime.ToDateTimeOffset(),
Deletion = u.Deletion != null ? u.Deletion.ToDateTimeOffset() : null
});
return Result.Success(dict);
}
catch (RpcException)
{
return Result.Fail<Dictionary<Guid, UserInfoDto>>(ResultCode.USER_NOT_FOUND);
}
}
}
}