mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-19 07:44:46 +08:00
feat(wxapi): 新增微信物流服务消息组件相关接口
This commit is contained in:
parent
06dede8d1d
commit
ecda47f97c
@ -677,6 +677,66 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryPathUpdateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/follow_waybill 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html#_4-1%E3%80%81%E4%BC%A0%E8%BF%90%E5%8D%95%E6%8E%A5%E5%8F%A3-follow-waybill </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryOpenMessageFollowWaybillResponse> ExecuteCgibinExpressDeliveryOpenMessageFollowWaybillAsync(this WechatApiClient client, Models.CgibinExpressDeliveryOpenMessageFollowWaybillRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "express", "delivery", "open_msg", "follow_waybill")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageFollowWaybillResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/query_follow_trace 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html#_4-1%E3%80%81%E4%BC%A0%E8%BF%90%E5%8D%95%E6%8E%A5%E5%8F%A3-follow-waybill </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryOpenMessageQueryFollowTraceResponse> ExecuteCgibinExpressDeliveryOpenMessageQueryFollowTraceAsync(this WechatApiClient client, Models.CgibinExpressDeliveryOpenMessageQueryFollowTraceRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "express", "delivery", "open_msg", "query_follow_trace")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageQueryFollowTraceResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/express/delivery/open_msg/update_follow_waybill_goods 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html#_4-1%E3%80%81%E4%BC%A0%E8%BF%90%E5%8D%95%E6%8E%A5%E5%8F%A3-follow-waybill </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsResponse> ExecuteCgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsAsync(this WechatApiClient client, Models.CgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "express", "delivery", "open_msg", "update_follow_waybill_goods")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/follow_waybill 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageFollowWaybillRequest : WechatApiRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Goods
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Detail
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
|
||||
public string GoodsName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品图片 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_img_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_img_url")]
|
||||
public string GoodsImageUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_desc")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_desc")]
|
||||
public string? GoodsDescription { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detail_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detail_list")]
|
||||
public IList<Types.Detail> DetailList { get; set; } = new List<Types.Detail>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置运单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||
public string WaybillId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置寄件人电话号码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sender_phone")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sender_phone")]
|
||||
public string? SenderPhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置收件人电话号码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("receiver_phone")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("receiver_phone")]
|
||||
public string? ReceiverPhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_info")]
|
||||
public Types.Goods? Goods { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信交易单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("trans_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("trans_id")]
|
||||
public string? TransactionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置落地页商品卡片跳转路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_detail_path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_detail_path")]
|
||||
public string? OrderDetailPagePath { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/follow_waybill 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageFollowWaybillResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信订单查询 Token。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_token")]
|
||||
public string WaybillToken { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/query_follow_trace 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageQueryFollowTraceRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信订单查询 Token。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_token")]
|
||||
public string WaybillToken { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/query_follow_trace 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageQueryFollowTraceResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Waybill
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置运单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||
public string WaybillId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置运单状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
}
|
||||
|
||||
public class Shop
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Goods
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Detail
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
|
||||
public string GoodsName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品图片 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_img_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_img_url")]
|
||||
public string GoodsImageUrl { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_desc")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_desc")]
|
||||
public string? GoodsDescription { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detail_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detail_list")]
|
||||
public Types.Detail[] DetailList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_info")]
|
||||
public Types.Goods? Goods { get; set; }
|
||||
}
|
||||
|
||||
public class Delivery
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置快递公司 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
|
||||
public string DeliveryId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递公司名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_name")]
|
||||
public string DeliveryName { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置运单信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_info")]
|
||||
public Types.Waybill Waybill { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置店铺信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shop_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shop_info")]
|
||||
public Types.Shop? Shop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_info")]
|
||||
public Types.Delivery? Delivery { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/update_follow_waybill_goods 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsRequest : WechatApiRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Goods
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Detail : CgibinExpressDeliveryOpenMessageFollowWaybillRequest.Types.Goods.Types.Detail
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detail_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detail_list")]
|
||||
public IList<Types.Detail> DetailList { get; set; } = new List<Types.Detail>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信订单查询 Token。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_token")]
|
||||
public string WaybillToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_info")]
|
||||
public Types.Goods? Goods { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/express/delivery/open_msg/update_follow_waybill_goods 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinExpressDeliveryOpenMessageUpdateFollowWaybillGoodsResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"openid": "ovtZW4yB7DIj3CxOb6ii-nk4HhFo",
|
||||
"waybill_id": "WXTESTEXPRESS0000014",
|
||||
"sender_phone": "12345678901",
|
||||
"receiver_phone": "123456566",
|
||||
"goods_info": {
|
||||
"detail_list": [
|
||||
{
|
||||
"goods_name": "测试名字",
|
||||
"goods_img_url": "www.baidu1.com"
|
||||
},
|
||||
{
|
||||
"goods_name": "测试名字2",
|
||||
"goods_img_url": "www.baidu2.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"waybill_token": "o_ARWHaxIxzWHmdui-AIw9KBr8qNnbmc08V0KhDyXE-IMLo6AcOqJkPsNLcLzfTb"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"waybill_token": "o_ARWHaxIxzWHmdui-AIw8SuE1QtaUZK8aUnZguAn1nsZ72ZjWlq8btV8j-wAc94",
|
||||
"openid": "ovtZW4yB7DIj3CxOb6ii-nk4HhFo"
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"waybill_info": {
|
||||
"status": 0,
|
||||
"waybill_id": "WXTESTEXPRESS0000014"
|
||||
},
|
||||
"shop_info": {
|
||||
"goods_info": {
|
||||
"detail_list": [
|
||||
{
|
||||
"goods_name": "测试名字",
|
||||
"goods_img_url": "www.baidu1.com"
|
||||
},
|
||||
{
|
||||
"goods_name": "测试名字2",
|
||||
"goods_img_url": "www.baidu2.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"waybill_token": "o_ARWHaxIxzWHmdui-AIw8SuE1QtaUZK8aUnZguAn1nsZ72ZjWlq8btV8j-wAc94",
|
||||
"openid": "ovtZW4yB7DIj3CxOb6ii-nk4HhFo",
|
||||
"goods_info": {
|
||||
"detail_list": [
|
||||
{
|
||||
"goods_name": "测试更新商品",
|
||||
"goods_img_url": "www.baidu.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok"
|
||||
}
|
Loading…
Reference in New Issue
Block a user