From 66a6e252876c7c65c22869f310b45b8f253e7210 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Tue, 28 Feb 2023 15:44:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E4=BA=8B=E4=BB=B6=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MpPush/UserAuthorizationRevokeEvent.cs | 34 +++++++++++++++++++ .../MpPush/UserAuthorizationRevokeEvent.json | 10 ++++++ .../MpPush/UserAuthorizationRevokeEvent.xml | 10 ++++++ 3 files changed, 54 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserAuthorizationRevokeEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserAuthorizationRevokeEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserAuthorizationRevokeEvent.cs new file mode 100644 index 00000000..ebad6930 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserAuthorizationRevokeEvent.cs @@ -0,0 +1,34 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.user_authorization_revoke 事件的数据。 + /// REF: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/authorization_change.html + /// + public class UserAuthorizationRevokeEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置微信 AppId。 + /// + [Newtonsoft.Json.JsonProperty("AppID")] + [System.Text.Json.Serialization.JsonPropertyName("AppID")] + [System.Xml.Serialization.XmlElement("AppID")] + public string AppId { get; set; } = default!; + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("OpenID")] + [System.Text.Json.Serialization.JsonPropertyName("OpenID")] + [System.Xml.Serialization.XmlElement("OpenID")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户撤回的授权信息。 + /// + [Newtonsoft.Json.JsonProperty("RevokeInfo")] + [System.Text.Json.Serialization.JsonPropertyName("RevokeInfo")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))] + [System.Xml.Serialization.XmlElement("RevokeInfo", IsNullable = true)] + public string? RevokeInfo { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.json new file mode 100644 index 00000000..e340e56b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.json @@ -0,0 +1,10 @@ +{ + "ToUserName": "gh_870882ca4b1", + "FromUserName": "oaKk346BaWE-eIn4oSRWbaM9vR7s", + "CreateTime": 1627359464, + "MsgType": "event", + "Event": "user_authorization_revoke", + "OpenID": "oaKk343WOktAaT2ygsX138BGblrg", + "AppID": "wx13974bf780d3dc89", + "RevokeInfo": "201" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.xml new file mode 100644 index 00000000..956b73c7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserAuthorizationRevokeEvent.xml @@ -0,0 +1,10 @@ + + + + 1626857200 + + + + + +