feat(work): 随官方更新微信客服

This commit is contained in:
fudiwei
2022-12-02 21:09:16 +08:00
parent ca698c52ed
commit bd3d18fd7c
12 changed files with 207 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
{
/// <summary>
/// <para>表示 EVENT.kf_account_auth_change 事件的数据。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/97712 </para>
/// </summary>
public class KfAccountAuthChangeEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable
{
/// <summary>
/// 获取或设置新增授权的客服账号 ID 列表。
/// </summary>
[System.Xml.Serialization.XmlElement("AuthAddOpenKfId", Type = typeof(string), IsNullable = true)]
public string[]? AuthAddedOpenKfId { get; set; }
/// <summary>
/// 获取或设置取消授权的客服账号 ID 列表。
/// </summary>
[System.Xml.Serialization.XmlElement("AuthDelOpenKfId", Type = typeof(string), IsNullable = true)]
public string[]? AuthDeletedOpenKfId { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
{
/// <summary>
/// <para>表示 kf_msg_or_event 事件的数据。</para>
/// <para>表示 EVENT.kf_msg_or_event 事件的数据。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/94670 </para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/94699 </para>
/// </summary>
@@ -10,7 +10,13 @@
/// <summary>
/// 获取或设置调用拉取消息的 Token。
/// </summary>
[System.Xml.Serialization.XmlElement("Content")]
[System.Xml.Serialization.XmlElement("Token")]
public string Token { get; set; } = default!;
/// <summary>
/// 获取或设置客服账号 ID。
/// </summary>
[System.Xml.Serialization.XmlElement("OpenKfId")]
public string OpenKfId { get; set; } = default!;
}
}

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/kf/account/list 接口的响应。</para>
@@ -29,6 +29,13 @@
[Newtonsoft.Json.JsonProperty("avatar")]
[System.Text.Json.Serialization.JsonPropertyName("avatar")]
public string AvatarUrl { get; set; } = default!;
/// <summary>
/// 获取或设置是否有该管理权限。
/// </summary>
[Newtonsoft.Json.JsonProperty("manage_privilege")]
[System.Text.Json.Serialization.JsonPropertyName("manage_privilege")]
public bool HasManagePivilege { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/kf/sync_msg 接口的请求。</para>
@@ -32,5 +32,12 @@
[Newtonsoft.Json.JsonProperty("voice_format")]
[System.Text.Json.Serialization.JsonPropertyName("voice_format")]
public int? VoiceFormat { get; set; }
/// <summary>
/// 获取或设置客服账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("open_kfid")]
[System.Text.Json.Serialization.JsonPropertyName("open_kfid")]
public string? OpenKfId { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/kf/sync_msg 接口的响应。</para>
@@ -75,6 +75,13 @@
[Newtonsoft.Json.JsonProperty("nickname")]
[System.Text.Json.Serialization.JsonPropertyName("nickname")]
public string? Nickname { get; set; }
/// <summary>
/// 获取或设置场景值。
/// </summary>
[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
{
/// <summary>
/// 获取或设置商品 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public string ProductId { get; set; } = default!;
/// <summary>
/// 获取或设置商品头图 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("head_img")]
[System.Text.Json.Serialization.JsonPropertyName("head_img")]
public string HeadImageUrl { get; set; } = default!;
/// <summary>
/// 获取或设置商品标题。
/// </summary>
[Newtonsoft.Json.JsonProperty("title")]
[System.Text.Json.Serialization.JsonPropertyName("title")]
public string Title { get; set; } = default!;
/// <summary>
/// 获取或设置商品价格(单位:分)。
/// </summary>
[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; }
/// <summary>
/// 获取或设置店铺名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_nickname")]
[System.Text.Json.Serialization.JsonPropertyName("shop_nickname")]
public string ShopNickname { get; set; } = default!;
/// <summary>
/// 获取或设置店铺头像 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_head_img")]
[System.Text.Json.Serialization.JsonPropertyName("shop_head_img")]
public string ShopHeadImageUrl { get; set; } = default!;
}
public class ChannelsShopOrderMessage
{
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = default!;
/// <summary>
/// 获取或设置商品标题。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_titles")]
[System.Text.Json.Serialization.JsonPropertyName("product_titles")]
public string ProductTitle { get; set; } = default!;
/// <summary>
/// 获取或设置商品价格描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("price_wording")]
[System.Text.Json.Serialization.JsonPropertyName("price_wording")]
public string PriceWording { get; set; } = default!;
/// <summary>
/// 获取或设置订单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("state")]
[System.Text.Json.Serialization.JsonPropertyName("state")]
public string State { get; set; } = default!;
/// <summary>
/// 获取或设置订单缩略图 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("image_url")]
[System.Text.Json.Serialization.JsonPropertyName("image_url")]
public string ImageUrl { get; set; } = default!;
/// <summary>
/// 获取或设置店铺名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_nickname")]
[System.Text.Json.Serialization.JsonPropertyName("shop_nickname")]
public string ShopNickname { get; set; } = default!;
}
}
/// <summary>
@@ -311,6 +409,20 @@
[System.Text.Json.Serialization.JsonPropertyName("event")]
public Types.EventMessage? MessageContentForEvent { get; set; }
/// <summary>
/// 获取或设置视频号商品消息信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("channels_shop_product")]
[System.Text.Json.Serialization.JsonPropertyName("channels_shop_product")]
public Types.ChannelsShopProductMessage? MessageContentForChannelsShopProduct { get; set; }
/// <summary>
/// 获取或设置视频号订单消息信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("channels_shop_order")]
[System.Text.Json.Serialization.JsonPropertyName("channels_shop_order")]
public Types.ChannelsShopOrderMessage? MessageContentForChannelsShopOrder { get; set; }
/// <summary>
/// 获取或设置发送时间戳。
/// </summary>

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{

View File

@@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/kf/customer/batchget 接口的响应。</para>

View File

@@ -0,0 +1,9 @@
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[sys]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_account_auth_change]]></Event>
<AuthAddOpenKfId><![CDATA[wkxxxx1]]></AuthAddOpenKfId>
<AuthDelOpenKfId><![CDATA[wkxxxx2]]></AuthDelOpenKfId>
</xml>

View File

@@ -0,0 +1,8 @@
<xml>
<ToUserName><![CDATA[ww12345678910]]></ToUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_msg_or_event]]></Event>
<Token><![CDATA[ENCApHxnGDNAVNY4AaSJKj4Tb5mwsEMzxhFmHVGcra996NR]]></Token>
<OpenKfId><![CDATA[wkxxxxxxx]]></OpenKfId>
</xml>

View File

@@ -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
}
]
}

View File

@@ -1,6 +1,7 @@
{
{
"cursor": "4gw7MepFLfgF2VC5npN",
"token": "ENCApHxnGDNAVNY4AaSJKj4Tb5mwsEMzxhFmHVGcra996NR",
"limit": 1000,
"voice_format": 0
"voice_format": 0,
"open_kfid": "wkxxxxxx"
}

View File

@@ -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"
}
}
]
}