修改通用返回

This commit is contained in:
2023-05-19 10:59:41 +08:00
parent 88c8d5e34c
commit 8bbdbc6cf5
5 changed files with 34 additions and 33 deletions
@@ -30,13 +30,13 @@
T Data { get; }
}
public interface IResponseOutput<T,T2> : IResponseOutput
{
/// <summary>
/// 返回数据
/// </summary>
T Data { get; }
//public interface IResponseOutput<T,T2> : IResponseOutput
//{
// /// <summary>
// /// 返回数据
// /// </summary>
// T Data { get; }
T2 OtherInfo { get; }
}
// T2 OtherInfo { get; }
//}
}
@@ -28,7 +28,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
public T Data { get; private set; }
[JsonProperty("OtherInfo")]
public object OtherData { get; set; }
@@ -77,31 +77,31 @@ namespace IRaCIS.Core.Infrastructure.Extention
}
public class ResponseOutput<T, T2> : IResponseOutput<T, T2>
{
[JsonProperty("Result")]
public T Data { get; private set; }
//public class ResponseOutput<T, T2> : IResponseOutput<T, T2>
//{
// [JsonProperty("Result")]
// public T Data { get; private set; }
public T2 OtherInfo { get; private set; }
// public T2 OtherInfo { get; private set; }
public bool IsSuccess { get; private set; }
// public bool IsSuccess { get; private set; }
public ApiResponseCodeEnum Code { get; set; }
// public ApiResponseCodeEnum Code { get; set; }
public string ErrorMessage { get; private set; }
// public string ErrorMessage { get; private set; }
public ResponseOutput<T, T2> Ok(T data, T2 otherInfo, string msg = "")
{
IsSuccess = true;
Data = data;
OtherInfo = otherInfo;
ErrorMessage = msg;
// public ResponseOutput<T, T2> Ok(T data, T2 otherInfo, string msg = "")
// {
// IsSuccess = true;
// Data = data;
// OtherInfo = otherInfo;
// ErrorMessage = msg;
return this;
}
}
// return this;
// }
//}
/// <summary>
@@ -111,10 +111,10 @@ namespace IRaCIS.Core.Infrastructure.Extention
{
public static IResponseOutput<T, T2> Ok<T, T2>(T data, T2 otherInfo, string msg = "")
{
return new ResponseOutput<T, T2>().Ok(data, otherInfo);
}
//public static IResponseOutput<T, T2> Ok<T, T2>(T data, T2 otherInfo, string msg = "")
//{
// return new ResponseOutput<T, T2>().Ok(data, otherInfo);
//}
/// <summary>