mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(wxapi): 新增视频号小店物流相关接口
This commit is contained in:
parent
307f4e6b05
commit
62b86d7c23
@ -117,6 +117,48 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OrderDelivery
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/order/deliverycompanylist/get 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/order/deliverycompanylist_get.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECOrderDeliveryCompanyListGetResponse> ExecuteChannelsECOrderDeliveryCompanyListGetAsync(this WechatApiClient client, Models.ChannelsECOrderDeliveryCompanyListGetRequest 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, "channels", "ec", "order", "deliverycompanylist", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ChannelsECOrderDeliveryCompanyListGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/order/delivery/send 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/order/delivery_send.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ChannelsECOrderDeliverySendResponse> ExecuteChannelsECOrderDeliverySendAsync(this WechatApiClient client, Models.ChannelsECOrderDeliverySendRequest 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, "channels", "ec", "order", "delivery", "send")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ChannelsECOrderDeliverySendResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ECWindow
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /channels/ec/window/product/add 接口。</para>
|
||||
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/order/deliverycompanylist/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECOrderDeliveryCompanyListGetRequest : WechatApiRequest, IInferable<ChannelsECOrderDeliveryCompanyListGetRequest, ChannelsECOrderDeliveryCompanyListGetResponse>
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/order/deliverycompanylist/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECOrderDeliveryCompanyListGetResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class DeliveryCompany
|
||||
{
|
||||
/// <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("company_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("company_list")]
|
||||
public Types.DeliveryCompany[] DeliveryCompanyList { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/order/delivery/send 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECOrderDeliverySendRequest : WechatApiRequest, IInferable<ChannelsECOrderDeliverySendRequest, ChannelsECOrderDeliverySendResponse>
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Delivery
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 SKU ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sku_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sku_id")]
|
||||
public long SKUId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_cnt")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_cnt")]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递公司 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
|
||||
public string DeliveryId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("waybill_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("waybill_id")]
|
||||
public string? WaybillId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置发货方式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("deliver_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("deliver_type")]
|
||||
public int DeliverType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_infos")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_infos")]
|
||||
public IList<Types.Product> ProductList { get; set; } = new List<Types.Product>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
|
||||
public long OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置快递列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("delivery_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("delivery_list")]
|
||||
public IList<Types.Delivery> DeliveryList { get; set; } = new List<Types.Delivery>();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /channels/ec/order/delivery/send 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ChannelsECOrderDeliverySendResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"company_list": [
|
||||
{
|
||||
"delivery_id": "SF",
|
||||
"delivery_name": "顺丰速运"
|
||||
},
|
||||
{
|
||||
"delivery_id": "YTO",
|
||||
"delivery_name": "圆通快速"
|
||||
},
|
||||
{
|
||||
"delivery_id": "ZTO",
|
||||
"delivery_name": "中通快速"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"order_id": "123456",
|
||||
"delivery_list": [
|
||||
{
|
||||
"delivery_id": "YD",
|
||||
"waybill_id": "23424324253",
|
||||
"deliver_type": 1,
|
||||
"product_infos": [
|
||||
{
|
||||
"product_cnt": 1,
|
||||
"product_id": "12345",
|
||||
"sku_id": "678910"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user