feat(wxapi): 修改部分回调通知事件模型,已支持 JSON 格式

This commit is contained in:
Fu Diwei
2021-06-07 00:34:41 +08:00
parent 8609f89c6d
commit f688049f01
54 changed files with 398 additions and 55 deletions

View File

@@ -7,7 +7,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events
/// <para>表示 EVENT.subscribe_msg_sent_event 事件的数据。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html#%E4%BA%8B%E4%BB%B6%E6%8E%A8%E9%80%81 </para>
/// </summary>
public class SubscribeMessageSentEvent : WechatApiEvent, WechatApiEvent.Types.IXmlSerializable
public class SubscribeMessageSentEvent : WechatApiEvent, WechatApiEvent.Types.IJsonSerializable, WechatApiEvent.Types.IXmlSerializable
{
public new static class Types
{
@@ -20,24 +20,32 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events
/// <summary>
/// 获取或设置订阅消息模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("TemplateId")]
[System.Text.Json.Serialization.JsonPropertyName("TemplateId")]
[System.Xml.Serialization.XmlElement("TemplateId")]
public string TemplateId { get; set; } = default!;
/// <summary>
/// 获取或设置消息 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("MsgID")]
[System.Text.Json.Serialization.JsonPropertyName("MsgID")]
[System.Xml.Serialization.XmlElement("MsgID")]
public long? MessageId { get; set; }
/// <summary>
/// 获取或设置推送结果状态码。
/// </summary>
[Newtonsoft.Json.JsonProperty("ErrorCode")]
[System.Text.Json.Serialization.JsonPropertyName("ErrorCode")]
[System.Xml.Serialization.XmlElement("ErrorCode")]
public int ErrorCode { get; set; }
/// <summary>
/// 获取或设置推送结果状态含义。
/// </summary>
[Newtonsoft.Json.JsonProperty("ErrorStatus")]
[System.Text.Json.Serialization.JsonPropertyName("ErrorStatus")]
[System.Xml.Serialization.XmlElement("ErrorStatus")]
public string ErrorMessage { get; set; } = default!;
}
@@ -46,6 +54,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events
/// <summary>
/// 获取或设置发送订阅通知数据列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("List")]
[System.Text.Json.Serialization.JsonPropertyName("List")]
[System.Xml.Serialization.XmlArray("List")]
public Types.EventItem[] EventList { get; set; } = default!;
}
@@ -54,6 +64,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events
/// <summary>
/// 获取或设置事件数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("SubscribeMsgSentEvent")]
[System.Text.Json.Serialization.JsonPropertyName("SubscribeMsgSentEvent")]
[System.Xml.Serialization.XmlElement("SubscribeMsgSentEvent")]
public Types.Data EventData { get; set; } = default!;
}