using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Estsh.Core.Model.Result { /// /// 公共返回结果对象 /// [Serializable] public class CommonResult { /// /// BaseResult构造函数 /// public CommonResult() { } /// /// BaseResult构造函数 /// /// 错误消息 /// 错误代码 public CommonResult(string message, string errcode) { this.message = message; this.ErrCode = errcode; } /// /// 构造函数 /// /// 错误消息 /// 成功或失败 /// 错误代码 public CommonResult(string message, bool success, string errcode) { this.message = message; this.ErrCode = errcode; this.success = success; } /// /// 错误代码 /// private string _errCode = "-1"; /// /// 错误描述信息 /// private string _message; /// /// 成功或失败 /// private bool _success = false; /// /// 账户类型 /// private string _accountType { get; set; } /// /// 用来传递的object内容 /// [DataMember] private object _resData; /// /// 错误代码 /// [DataMember] public string ErrCode { get { return _errCode; } set { _errCode = value; if (value == "0") { success= _success = true; } else { success = _success = false; } } } /// /// 如果不成功,返回的错误描述信息 /// [DataMember] public string message { get { return _message; } set { _message = value; } } /// /// 成功返回true,失败返回false /// [DataMember] public bool success { get { if (ErrCode == "0") { _success = true; } return _success; } set { _success = value; } } /// /// 用来传递的object内容 /// [DataMember] public string accountType { get => _accountType; set => _accountType = value; } /// /// 用来传递的object内容 /// [DataMember] public object resData { get => _resData; set => _resData = value; } } }