From ae0325d6389a76da364bb75db43a6c60880155ee Mon Sep 17 00:00:00 2001 From: fudiwei Date: Sat, 11 Sep 2021 17:52:26 +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=E8=B5=84=E6=96=99=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/OpenPush/UserInfoModifiedEvent.cs | 29 +++++++++++++++++++ .../OpenPush/UserInfoModifiedEvent.json | 9 ++++++ .../OpenPush/UserInfoModifiedEvent.xml | 9 ++++++ 3 files changed, 47 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenPush/UserInfoModifiedEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenPush/UserInfoModifiedEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenPush/UserInfoModifiedEvent.cs new file mode 100644 index 00000000..760eecab --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/OpenPush/UserInfoModifiedEvent.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.user_info_modified 事件的数据。 + /// REF: https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/authorization_change.html + /// REF: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/authorization_change.html + /// + public class UserInfoModifiedEvent : 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!; + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.json new file mode 100644 index 00000000..0f44be04 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.json @@ -0,0 +1,9 @@ +{ + "ToUserName": "gh_SDK_870882ca4b1", + "FromUserName": "oaKk346BaWE-eIn4oSRWbaM9vR7s", + "CreateTime": 1627359464, + "MsgType": "event", + "Event": "user_info_modified", + "openid": "oaKk343WOktAaT2ygsX138BGblrg", + "appid" : "wx13974bf780d3dc89" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.xml new file mode 100644 index 00000000..87263a74 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/OpenPush/UserInfoModifiedEvent.xml @@ -0,0 +1,9 @@ + + + + 1626857200 + + + + +