|
| 1 | +#region Apache License Version 2.0 |
| 2 | +/*---------------------------------------------------------------- |
| 3 | +
|
| 4 | +Copyright 2020 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. |
| 5 | +
|
| 6 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file |
| 7 | +except in compliance with the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | +Unless required by applicable law or agreed to in writing, software distributed under the |
| 12 | +License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
| 13 | +either express or implied. See the License for the specific language governing permissions |
| 14 | +and limitations under the License. |
| 15 | +
|
| 16 | +Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md |
| 17 | +
|
| 18 | +----------------------------------------------------------------*/ |
| 19 | +#endregion Apache License Version 2.0 |
| 20 | + |
| 21 | +/*---------------------------------------------------------------- |
| 22 | + Copyright (C) 2020 Senparc |
| 23 | +
|
| 24 | + 文件名:WxJsonResult.cs |
| 25 | + 文件功能描述:同于公众号的JSON返回结果基类(用于菜单接口等) |
| 26 | +
|
| 27 | +
|
| 28 | + 创建标识:Senparc - 20150211 |
| 29 | +
|
| 30 | + 修改标识:Senparc - 20150303 |
| 31 | + 修改描述:整理接口 |
| 32 | +
|
| 33 | + 修改标识:Senparc - 20150303 |
| 34 | + 修改描述:添加QyJsonResult(企业号JSON返回结果) |
| 35 | +
|
| 36 | + 修改标识:Senparc - 20150706 |
| 37 | + 修改描述:调整位置,去除MP下的WxJsonResult |
| 38 | + |
| 39 | + 修改标识:Senparc - 20161108 |
| 40 | + 修改描述:重写ToString()方法,快捷输出结果 |
| 41 | +
|
| 42 | + 修改标识:Senparc - 20170702 |
| 43 | + 修改描述:将 IWxJsonResult 定义从 IJsonResult.cs 文件移入 |
| 44 | +
|
| 45 | + 修改标识:Senparc - 20170702 |
| 46 | + 修改描述:v4.13.0 添加 ErrorCodeValue 属性。使用 BaseJsonResult 基类。 |
| 47 | +----------------------------------------------------------------*/ |
| 48 | + |
| 49 | +using Senparc.NeuChar.Entities; |
| 50 | +using System; |
| 51 | + |
| 52 | +namespace Senparc.Toutiao.Entities |
| 53 | +{ |
| 54 | + /// <summary> |
| 55 | + /// 包含 errorcode 的 Json 返回结果接口 |
| 56 | + /// </summary> |
| 57 | + public interface IWxJsonResult : IJsonResult |
| 58 | + { |
| 59 | + /// <summary> |
| 60 | + /// 返回结果代码 |
| 61 | + /// </summary> |
| 62 | + ReturnCode errcode { get; set; } |
| 63 | + } |
| 64 | + |
| 65 | + /// <summary> |
| 66 | + /// 公众号 JSON 返回结果(用于菜单接口等),子类必须具有不带参数的构造函数 |
| 67 | + /// </summary> |
| 68 | + [Serializable] |
| 69 | + public class TtJsonResult : BaseJsonResult |
| 70 | + { |
| 71 | + //会造成循环引用 |
| 72 | + //public WxJsonResult BaseResult |
| 73 | + //{ |
| 74 | + // get { return this; } |
| 75 | + //} |
| 76 | + |
| 77 | + public ReturnCode errcode { get; set; } |
| 78 | + |
| 79 | + /// <summary> |
| 80 | + /// 返回消息代码数字(同errcode枚举值) |
| 81 | + /// </summary> |
| 82 | + public override int ErrorCodeValue { get { return (int)errcode; } } |
| 83 | + |
| 84 | + /// <summary> |
| 85 | + /// 无参数的构造函数 |
| 86 | + /// </summary> |
| 87 | + public TtJsonResult() { } |
| 88 | + |
| 89 | + |
| 90 | + public override string ToString() |
| 91 | + { |
| 92 | + return string.Format("WxJsonResult:{{errcode:'{0}',errcode_name:'{1}',errmsg:'{2}'}}", |
| 93 | + (int)errcode, errcode.ToString(), errmsg); |
| 94 | + } |
| 95 | + |
| 96 | + //public ReturnCode ReturnCode |
| 97 | + //{ |
| 98 | + // get |
| 99 | + // { |
| 100 | + // try |
| 101 | + // { |
| 102 | + // return (ReturnCode) errorcode; |
| 103 | + // } |
| 104 | + // catch |
| 105 | + // { |
| 106 | + // return ReturnCode.系统繁忙;//如果有“其他错误”的话可以指向其他错误 |
| 107 | + // } |
| 108 | + // } |
| 109 | + //} |
| 110 | + //public void SerializingCallback() |
| 111 | + //{ |
| 112 | + //} |
| 113 | + |
| 114 | + //public void SrializedCallback(string json) |
| 115 | + //{ |
| 116 | + // throw new NotImplementedException(); |
| 117 | + //} |
| 118 | + |
| 119 | + //public void DeserializingCallback(string json) |
| 120 | + //{ |
| 121 | + // throw new NotImplementedException(); |
| 122 | + //} |
| 123 | + |
| 124 | + //public void DeserializedCallback(string json) |
| 125 | + //{ |
| 126 | + // throw new NotImplementedException(); |
| 127 | + //} |
| 128 | + } |
| 129 | +} |
0 commit comments