From 64ecf01a0b19651f58e2b9cf4fe83777e36b5a97 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Thu, 2 Mar 2023 21:55:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=9C=A8=E5=B0=8F=E7=A8=8B=E5=BA=8F=E2=80=9C=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E4=BC=9A=E8=AF=9D=E6=8C=89=E9=92=AE=E2=80=9D=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=AE=A2=E6=9C=8D=E4=BC=9A=E8=AF=9D=E6=97=B6=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E7=9A=84=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MpMessage/MiniProgramPageMessageEvent.cs | 2 +- .../Events/MpPush/UserEnterTempSessionEvent.cs | 17 +++++++++++++++++ .../MpPush/UserEnterTempSessionEvent.json | 8 ++++++++ .../MpPush/UserEnterTempSessionEvent.xml | 8 ++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserEnterTempSessionEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpMessage/MiniProgramPageMessageEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpMessage/MiniProgramPageMessageEvent.cs index dc57eb79..2fb952bb 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpMessage/MiniProgramPageMessageEvent.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpMessage/MiniProgramPageMessageEvent.cs @@ -2,7 +2,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events { /// /// 表示 MINIPROGRAMPAGE 事件的数据。 - /// REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html#%E6%96%87%E6%9C%AC%E6%B6%88%E6%81%AF + /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/receive.html /// public class MiniProgramPageMessageEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable { diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserEnterTempSessionEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserEnterTempSessionEvent.cs new file mode 100644 index 00000000..0cf87b6b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Events/MpPush/UserEnterTempSessionEvent.cs @@ -0,0 +1,17 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Events +{ + /// + /// 表示 EVENT.user_enter_tempsession 事件的数据。 + /// REF: https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/receive.html + /// + public class UserEnterTempSessionEvent : WechatApiEvent, WechatApiEvent.Serialization.IJsonSerializable, WechatApiEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置会话来源。 + /// + [Newtonsoft.Json.JsonProperty("SessionFrom")] + [System.Text.Json.Serialization.JsonPropertyName("SessionFrom")] + [System.Xml.Serialization.XmlElement("SessionFrom")] + public string SessionFrom { get; set; } = default!; + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.json new file mode 100644 index 00000000..fe083639 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.json @@ -0,0 +1,8 @@ +{ + "ToUserName": "toUser", + "FromUserName": "fromUser", + "CreateTime": 1482048670, + "MsgType": "event", + "Event": "user_enter_tempsession", + "SessionFrom": "sessionFrom" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.xml new file mode 100644 index 00000000..981c76a4 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/EventSamples/MpPush/UserEnterTempSessionEvent.xml @@ -0,0 +1,8 @@ + + + + 1482048670 + + + +