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

45 lines
1.5 KiB
C#
Raw Normal View History

2024-04-10 13:55:27 +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;
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>();
}
}
}