Files
SOP/sop-sdk/sdk-csharp/SDKCSharp/Common/Result.cs
六如 403e8111f4 5.0
2024-12-22 23:09:46 +08:00

54 lines
1.3 KiB
C#
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using Newtonsoft.Json;
namespace SDKCSharp.Common
{
/// <summary>
/// 返回的Response新建Response要继承这个类
/// </summary>
public class Result<T>
{
/// <summary>
/// 状态码0表示成功其它都是失败
/// </summary>
[JsonProperty("code")]
public string Code { get; set; }
/// <summary>
/// 消息,如果有错误则为错误信息
/// </summary>
[JsonProperty("msg")]
public string Msg { get; set; }
/// <summary>
/// 错误状态码
/// </summary>
/// <value>The sub code.</value>
[JsonProperty("sub_code")]
public string SubCode { get; set; }
/// <summary>
/// 错误消息
/// </summary>
/// <value>The sub message.</value>
[JsonProperty("sub_msg")]
public string SubMsg { get; set; }
/// <summary>
/// 响应原始内容
/// </summary>
[JsonProperty("data")]
public T Data { get; set; }
/// <summary>
/// 是否成功
/// </summary>
/// <returns></returns>
public bool IsSuccess()
{
return string.IsNullOrEmpty(SubCode);
}
}
}