Files
juipnet/Infrastructure/ServiceClient/BaseInfoClient/Response/Manage/QueryAllManageByOwnerIdResponse.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2020-12-28 14:55:48 +08:00
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BaseInfoClient.Response.Manage;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using ServiceClient;
namespace BaseInfoClient.Response.Manage
{
}
namespace BaseInfoClient.Extension
{
public static class QueryAllManageByOwnerIdResponse
{
public static async Task<ManageItem> QueryManageById(this BaseInfoHttpClient client
, int Id, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/manage/v1/Manager/GetOneManage?Id={Id}");
var content = await response.Content.ReadAsStringAsync();
var result = content.FromJsonTo<ApiResult<ManageItem>>();
return result.Data;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new ManageItem();
}
}
return new ManageItem();
}
}
}