using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VOL.Model.XW { /// /// 通用返回类 /// /// 数据对象类型 public class XWApiResponse { /// /// 业务逻辑是否调用成功 /// 默认值为 true /// public bool Success { get; set; } = true; /// /// 错误码 /// public string? ErrorCode { get; set; } /// /// 错误信息 /// public string? ErrorMsg { get; set; } /// /// 返回的数据对象 /// public T? Data { get; set; } /// /// 构造函数,初始化空的成功响应 /// public XWApiResponse() { } /// /// 构造函数,初始化带数据的响应 /// /// 返回的数据 public XWApiResponse(T data) { Data = data; Success = true; } /// /// 构造函数,初始化带错误的响应 /// /// 错误码 /// 错误信息 public XWApiResponse(string errorCode, string errorMsg) { Success = false; ErrorCode = errorCode; ErrorMsg = errorMsg; } } }