|
|
|
|
namespace Ds.Module.ResultFilter
|
|
|
|
|
{
|
|
|
|
|
public class DsJsonResult
|
|
|
|
|
{
|
|
|
|
|
public bool Success { get; set; }
|
|
|
|
|
public int Code { get; set; }
|
|
|
|
|
public string? Msg { get; set; }
|
|
|
|
|
|
|
|
|
|
public Object? Data { get; set; }
|
|
|
|
|
|
|
|
|
|
public DsJsonResult()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)DsResultCode.Fail;
|
|
|
|
|
Msg = DsResultTool.DescriptionsDictionary[(DsResultCode)Code];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success, string msg)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)DsResultCode.Fail;
|
|
|
|
|
Msg = msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success, DsResultCode resultEnum)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)resultEnum;
|
|
|
|
|
Msg = DsResultTool.DescriptionsDictionary[(DsResultCode)Code];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success, Object data)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)DsResultCode.Fail;
|
|
|
|
|
Msg = DsResultTool.DescriptionsDictionary[(DsResultCode)Code];
|
|
|
|
|
Data = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success, DsResultCode resultEnum, Object data)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)resultEnum;
|
|
|
|
|
Msg = DsResultTool.DescriptionsDictionary[(DsResultCode)Code];
|
|
|
|
|
Data = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DsJsonResult(bool success, DsResultCode resultEnum, string msg)
|
|
|
|
|
{
|
|
|
|
|
Success = success;
|
|
|
|
|
Code = success ? (int)DsResultCode.Success : (int)resultEnum;
|
|
|
|
|
this.Msg = msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public class ApiResponse<T>
|
|
|
|
|
//{
|
|
|
|
|
// public bool Success { get; set; }
|
|
|
|
|
// public string Message { get; set; }
|
|
|
|
|
// public T Data { get; set; }
|
|
|
|
|
|
|
|
|
|
// public ApiResponse(bool success, string message, T data)
|
|
|
|
|
// {
|
|
|
|
|
// Success = success;
|
|
|
|
|
// Message = message;
|
|
|
|
|
// Data = data;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public ApiResponse(bool success, string message)
|
|
|
|
|
// : this(success, message, default(T))
|
|
|
|
|
// {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public ApiResponse(T data)
|
|
|
|
|
// : this(true, string.Empty, data)
|
|
|
|
|
// {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public ApiResponse()
|
|
|
|
|
// : this(true, string.Empty, default(T))
|
|
|
|
|
// {
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|