diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfAccountAuthChangeEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfAccountAuthChangeEvent.cs new file mode 100644 index 00000000..7ffd5fb7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfAccountAuthChangeEvent.cs @@ -0,0 +1,21 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 EVENT.kf_account_auth_change 事件的数据。 + /// REF: https://developer.work.weixin.qq.com/document/path/97712 + /// + public class KfAccountAuthChangeEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置新增授权的客服账号 ID 列表。 + /// + [System.Xml.Serialization.XmlElement("AuthAddOpenKfId", Type = typeof(string), IsNullable = true)] + public string[]? AuthAddedOpenKfId { get; set; } + + /// + /// 获取或设置取消授权的客服账号 ID 列表。 + /// + [System.Xml.Serialization.XmlElement("AuthDelOpenKfId", Type = typeof(string), IsNullable = true)] + public string[]? AuthDeletedOpenKfId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfMessageEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfMessageEvent.cs index b362683b..8c8b0b4b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfMessageEvent.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/KfMessage/KfMessageEvent.cs @@ -1,7 +1,7 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Events +namespace SKIT.FlurlHttpClient.Wechat.Work.Events { /// - /// 表示 kf_msg_or_event 事件的数据。 + /// 表示 EVENT.kf_msg_or_event 事件的数据。 /// REF: https://developer.work.weixin.qq.com/document/path/94670 /// REF: https://developer.work.weixin.qq.com/document/path/94699 /// @@ -10,7 +10,13 @@ /// /// 获取或设置调用拉取消息的 Token。 /// - [System.Xml.Serialization.XmlElement("Content")] + [System.Xml.Serialization.XmlElement("Token")] public string Token { get; set; } = default!; + + /// + /// 获取或设置客服账号 ID。 + /// + [System.Xml.Serialization.XmlElement("OpenKfId")] + public string OpenKfId { get; set; } = default!; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Account/CgibinKfAccountListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Account/CgibinKfAccountListResponse.cs index 33599f8d..ad5409fa 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Account/CgibinKfAccountListResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Account/CgibinKfAccountListResponse.cs @@ -1,4 +1,4 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Models +namespace SKIT.FlurlHttpClient.Wechat.Work.Models { /// /// 表示 [POST] /cgi-bin/kf/account/list 接口的响应。 @@ -29,6 +29,13 @@ [Newtonsoft.Json.JsonProperty("avatar")] [System.Text.Json.Serialization.JsonPropertyName("avatar")] public string AvatarUrl { get; set; } = default!; + + /// + /// 获取或设置是否有该管理权限。 + /// + [Newtonsoft.Json.JsonProperty("manage_privilege")] + [System.Text.Json.Serialization.JsonPropertyName("manage_privilege")] + public bool HasManagePivilege { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageRequest.cs index 91f02f5d..93108b55 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageRequest.cs @@ -1,4 +1,4 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Models +namespace SKIT.FlurlHttpClient.Wechat.Work.Models { /// /// 表示 [POST] /cgi-bin/kf/sync_msg 接口的请求。 @@ -32,5 +32,12 @@ [Newtonsoft.Json.JsonProperty("voice_format")] [System.Text.Json.Serialization.JsonPropertyName("voice_format")] public int? VoiceFormat { get; set; } + + /// + /// 获取或设置客服账号 ID。 + /// + [Newtonsoft.Json.JsonProperty("open_kfid")] + [System.Text.Json.Serialization.JsonPropertyName("open_kfid")] + public string? OpenKfId { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageResponse.cs index 966734f2..5638be45 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/CgibinKfSyncMessageResponse.cs @@ -1,4 +1,4 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Models +namespace SKIT.FlurlHttpClient.Wechat.Work.Models { /// /// 表示 [POST] /cgi-bin/kf/sync_msg 接口的响应。 @@ -75,6 +75,13 @@ [Newtonsoft.Json.JsonProperty("nickname")] [System.Text.Json.Serialization.JsonPropertyName("nickname")] public string? Nickname { get; set; } + + /// + /// 获取或设置场景值。 + /// + [Newtonsoft.Json.JsonProperty("scene")] + [System.Text.Json.Serialization.JsonPropertyName("scene")] + public int Scene { get; set; } } } @@ -190,6 +197,97 @@ [System.Text.Json.Serialization.JsonPropertyName("recall_msgid")] public string? RecalledMessageId { get; set; } } + + public class ChannelsShopProductMessage + { + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public string ProductId { get; set; } = default!; + + /// + /// 获取或设置商品头图 URL。 + /// + [Newtonsoft.Json.JsonProperty("head_img")] + [System.Text.Json.Serialization.JsonPropertyName("head_img")] + public string HeadImageUrl { get; set; } = default!; + + /// + /// 获取或设置商品标题。 + /// + [Newtonsoft.Json.JsonProperty("title")] + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string Title { get; set; } = default!; + + /// + /// 获取或设置商品价格(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("sales_price")] + [System.Text.Json.Serialization.JsonPropertyName("sales_price")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int SalesPrice { get; set; } + + /// + /// 获取或设置店铺名称。 + /// + [Newtonsoft.Json.JsonProperty("shop_nickname")] + [System.Text.Json.Serialization.JsonPropertyName("shop_nickname")] + public string ShopNickname { get; set; } = default!; + + /// + /// 获取或设置店铺头像 URL。 + /// + [Newtonsoft.Json.JsonProperty("shop_head_img")] + [System.Text.Json.Serialization.JsonPropertyName("shop_head_img")] + public string ShopHeadImageUrl { get; set; } = default!; + } + + public class ChannelsShopOrderMessage + { + /// + /// 获取或设置订单 ID。 + /// + [Newtonsoft.Json.JsonProperty("order_id")] + [System.Text.Json.Serialization.JsonPropertyName("order_id")] + public string OrderId { get; set; } = default!; + + /// + /// 获取或设置商品标题。 + /// + [Newtonsoft.Json.JsonProperty("product_titles")] + [System.Text.Json.Serialization.JsonPropertyName("product_titles")] + public string ProductTitle { get; set; } = default!; + + /// + /// 获取或设置商品价格描述。 + /// + [Newtonsoft.Json.JsonProperty("price_wording")] + [System.Text.Json.Serialization.JsonPropertyName("price_wording")] + public string PriceWording { get; set; } = default!; + + /// + /// 获取或设置订单状态。 + /// + [Newtonsoft.Json.JsonProperty("state")] + [System.Text.Json.Serialization.JsonPropertyName("state")] + public string State { get; set; } = default!; + + /// + /// 获取或设置订单缩略图 URL。 + /// + [Newtonsoft.Json.JsonProperty("image_url")] + [System.Text.Json.Serialization.JsonPropertyName("image_url")] + public string ImageUrl { get; set; } = default!; + + /// + /// 获取或设置店铺名称。 + /// + [Newtonsoft.Json.JsonProperty("shop_nickname")] + [System.Text.Json.Serialization.JsonPropertyName("shop_nickname")] + public string ShopNickname { get; set; } = default!; + } } /// @@ -311,6 +409,20 @@ [System.Text.Json.Serialization.JsonPropertyName("event")] public Types.EventMessage? MessageContentForEvent { get; set; } + /// + /// 获取或设置视频号商品消息信息。 + /// + [Newtonsoft.Json.JsonProperty("channels_shop_product")] + [System.Text.Json.Serialization.JsonPropertyName("channels_shop_product")] + public Types.ChannelsShopProductMessage? MessageContentForChannelsShopProduct { get; set; } + + /// + /// 获取或设置视频号订单消息信息。 + /// + [Newtonsoft.Json.JsonProperty("channels_shop_order")] + [System.Text.Json.Serialization.JsonPropertyName("channels_shop_order")] + public Types.ChannelsShopOrderMessage? MessageContentForChannelsShopOrder { get; set; } + /// /// 获取或设置发送时间戳。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetRequest.cs index 5b51b271..37d215f2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetRequest.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace SKIT.FlurlHttpClient.Wechat.Work.Models { diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetResponse.cs index c7f9a45f..beb779f2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinKf/Customer/CgibinKfCustomerBatchGetResponse.cs @@ -1,4 +1,4 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Models +namespace SKIT.FlurlHttpClient.Wechat.Work.Models { /// /// 表示 [POST] /cgi-bin/kf/customer/batchget 接口的响应。 diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfAccountAuthChangeEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfAccountAuthChangeEvent.xml new file mode 100644 index 00000000..4e536d1f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfAccountAuthChangeEvent.xml @@ -0,0 +1,9 @@ + + + + 1348831860 + + + + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfMessageEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfMessageEvent.xml new file mode 100644 index 00000000..fe9452e1 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/KfMessage/KfMessageEvent.xml @@ -0,0 +1,8 @@ + + + 1348831860 + + + + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/Account/CgibinKfAccountListResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/Account/CgibinKfAccountListResponse.json index 779cd9e9..c4b335c1 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/Account/CgibinKfAccountListResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/Account/CgibinKfAccountListResponse.json @@ -1,11 +1,12 @@ -{ +{ "errcode": 0, "errmsg": "ok", "account_list": [ { "open_kfid": "wkAJ2GCAAASSm4_FhToWMFea0xAFfd3Q", "name": "咨询客服", - "avatar": "https://wework.qpic.cn/wwhead/duc2TvpEgSSjibPZlNR6chpx9W3dtd9Ogp8XEmSNKGa6uufMWn2239HUPuwIFoYYZ7Ph580FPvo8/0" + "avatar": "https://wework.qpic.cn/wwhead/duc2TvpEgSSjibPZlNR6chpx9W3dtd9Ogp8XEmSNKGa6uufMWn2239HUPuwIFoYYZ7Ph580FPvo8/0", + "manage_privilege": false } ] } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageRequest.json index 45c2fb93..ee9c937e 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageRequest.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageRequest.json @@ -1,6 +1,7 @@ -{ +{ "cursor": "4gw7MepFLfgF2VC5npN", "token": "ENCApHxnGDNAVNY4AaSJKj4Tb5mwsEMzxhFmHVGcra996NR", "limit": 1000, - "voice_format": 0 + "voice_format": 0, + "open_kfid": "wkxxxxxx" } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageResponse.json index f455c2ac..dda784c5 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinKf/CgibinKfSyncMessageResponse.json @@ -1,4 +1,4 @@ -{ +{ "errcode": 0, "errmsg": "ok", "next_cursor": "4gw7MepFLfgF2VC5npN", @@ -31,6 +31,28 @@ "recall_msgid": "RECALL_MSGID", "servicer_userid": "SERVICER_USERID" } + }, + { + "msgtype": "channels_shop_product", + "channels_shop_product": { + "product_id": "PRODUCT_ID", + "head_img": "PRODUCT_IMANGE_URL", + "title": "TITLE", + "sales_price": 0, + "shop_nickname": "SHOP_NICKNAME", + "shop_head_img": "SHOP_HEAD_IMG" + } + }, + { + "msgtype": "channels_shop_order", + "channels_shop_order": { + "order_id": "ORDER_ID", + "product_titles": "PRODUCT_TITLES", + "price_wording": "PRICE_WORDING", + "state": "STATE", + "image_url": "IMAGE_URL", + "shop_nickname": "SHOP_NICKNAME" + } } ] }