using System; using System.Collections.Generic; using System.Text; namespace Mini.Model.CrmModel { public class retMsg { public bool result { get; set; } public int retcode { get; set; } public string retmsg { get; set; } public void SetFail(string msg, int code) { this.result = false; this.retcode = code; this.retmsg = msg; } public void SetResult(ApiResult result) { this.result = result.success; this.retcode = result.code; this.retmsg = result.msg; } public void SetResult(bool success, int code, string msg) { this.result = success; this.retcode = code; this.retmsg = msg; } } public class retMsg { public bool result { get; set; } public int retcode { get; set; } public string retmsg { get; set; } /// /// 数据 /// public T retData { get; set; } public Laypage retpage { get; set; } public void SetFail(string msg, int code) { this.result = false; this.retcode = code; this.retmsg = msg; } public void SetResult(ApiResult result) { this.result = result.success; this.retcode = result.code; if (result.success) { Type t = typeof(T); if (t == typeof(string)) { this.retData = result.data; } else if (t == typeof(int)) { this.retData = result.data; } else if (t == typeof(long)) { this.retData = result.data; } else if (result.data != null) { this.retData = result.data.ToObject(); } if (result.page != null) { this.retpage = result.page; } } else this.retmsg = result.msg; } } }