忽略
This commit is contained in:
@@ -1,57 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Etor.Infrastructure.Common;
|
||||
using Etor.Infrastructure.Data;
|
||||
using Etor.Infrastructure.Serializer;
|
||||
using Etor.Infrastructure.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using ServiceClient;
|
||||
using ServiceClient.Response.Room;
|
||||
|
||||
namespace ServiceClient.Response.Room
|
||||
{
|
||||
|
||||
|
||||
public class QueryHouseholderRoomsByUserIdResponse
|
||||
{
|
||||
[JsonProperty("userToRoomData")]
|
||||
public List<UserRoomItem> UserRoomItems { get; set; } = new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
|
||||
namespace BaseInfoClient.Extension
|
||||
{
|
||||
public static class QueryHouseholderRoomsByUserIdExtension
|
||||
{
|
||||
public static async Task<List<UserRoomItem>> QueryHouseholderRoomsByUserId(this BaseInfoHttpClient client
|
||||
, int ownerId, int userId, bool throwException = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await client.CreateHttpClient().GetAsync(
|
||||
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetOneBasePerson?Data.userToroomUserId={userId}&OwnerID={ownerId}");
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
return content.FromJsonTo<ApiResult<QueryHouseholderRoomsByUserIdResponse>>().Data.UserRoomItems;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.Error("根据UserId获取用户房间信息", e);
|
||||
|
||||
if (throwException)
|
||||
{
|
||||
BusinessException.Throw("获取用户房间信息失败");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
|
||||
return new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Etor.Infrastructure.Common;
|
||||
using Etor.Infrastructure.Data;
|
||||
using Etor.Infrastructure.Serializer;
|
||||
using Etor.Infrastructure.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using ServiceClient;
|
||||
using ServiceClient.Response.Room;
|
||||
|
||||
namespace ServiceClient.Response.Room
|
||||
{
|
||||
|
||||
|
||||
public class QueryHouseholderRoomsByUserIdResponse
|
||||
{
|
||||
[JsonProperty("userToRoomData")]
|
||||
public List<UserRoomItem> UserRoomItems { get; set; } = new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
|
||||
namespace BaseInfoClient.Extension
|
||||
{
|
||||
public static class QueryHouseholderRoomsByUserIdExtension
|
||||
{
|
||||
public static async Task<List<UserRoomItem>> QueryHouseholderRoomsByUserId(this BaseInfoHttpClient client
|
||||
, int ownerId, int userId, bool throwException = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await client.CreateHttpClient().GetAsync(
|
||||
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetOneBasePerson?Data.userToroomUserId={userId}&OwnerID={ownerId}");
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
return content.FromJsonTo<ApiResult<QueryHouseholderRoomsByUserIdResponse>>().Data.UserRoomItems;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.Error("根据UserId获取用户房间信息", e);
|
||||
|
||||
if (throwException)
|
||||
{
|
||||
BusinessException.Throw("获取用户房间信息失败");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
|
||||
return new List<UserRoomItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user