Files
juipnet/Infrastructure/ServiceClient/BaseInfoClient/Response/Manage/QueryPermissionProjectByManagerIdResponse.cs
wanyongkang d318014316 初始提交
2020-10-07 20:25:03 +08:00

45 lines
1.5 KiB
C#

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;
using System.Text;
namespace BaseInfoClient.Extension
{
public static class QueryPermissionProjectByManagerIdResponse
{
public static async Task<List<PermissionProjectByManagerItem>> QueryProjectCodeByManageId(this BaseInfoHttpClient client
, int Id, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/manage/v1/Manager/GetByManageId?ManagerId={Id}");
var content = await response.Content.ReadAsStringAsync();
var result = content.FromJsonTo<ApiResult<List<PermissionProjectByManagerItem>>>();
return result.Data;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new List<PermissionProjectByManagerItem>();
}
}
return new List<PermissionProjectByManagerItem>();
}
}
}