using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyCode.Project.Infrastructure.JackYun { /// /// API调用返回结果。 /// public class JackyunResponse { /// /// 构造器 /// /// 业务信息结果 /// 子级错误码 /// 错误消息 /// public JackyunResponse(Object result, string subCode, string msg, string contextId) { Dictionary dictionary = new Dictionary(); dictionary.Add("data", result); dictionary.Add("contextId", contextId); this.result = dictionary; this.subCode = subCode; this.msg = msg; } /// /// 构造器。 /// /// 业务信息结果 /// 子级错误码 /// 错误消息 public JackyunResponse(Object result, string subCode, string msg) : this(result, subCode, msg, null) { ; } /// /// 构造器。 /// /// 子级错误码 /// 错误消息 public JackyunResponse(string subCode, string msg) : this(null, subCode, msg, null) { ; } /// /// 构造器 无参 /// public JackyunResponse() { } /// /// 返回码 /// public string code { get; set; } /// /// 子级错误码 /// public string subCode { get; set; } /// /// 错误消息 /// public string msg { get; set; } /// /// 错误结果 /// public Object result { get; set; } /// /// 当请求失败 /// /// 返回消息 /// 子级返回码 public void onFail(string msg, string subCode) { this.code = "0"; this.msg = msg; this.subCode = subCode; } /// /// 当请求成功 /// public void onSuccess() { this.code = "200"; } /// /// 是否成功 /// /// 是否成功 public bool isSuccess() { return "200".Equals(this.code); } } }