feat(wxapi): 新增微信小店联盟带货机构分发优惠券给其他机构相关接口

This commit is contained in:
Fu Diwei
2025-11-27 15:36:32 +08:00
parent 94d09e6025
commit d031e72364
14 changed files with 239 additions and 2 deletions

View File

@@ -6286,6 +6286,52 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterGetCouponPromoterShareLinkResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/leagueheadsupplier/api/sharer/coupon/api_set_coupon_to_headsupplier.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECPromoterSetCouponToHeadSupplierResponse> ExecuteChannelsECPromoterSetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterSetCouponToHeadSupplierRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "promoter", "set_coupon_to_headsupplier")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterSetCouponToHeadSupplierResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/leagueheadsupplier/api/sharer/coupon/api_get_coupon_to_headsupplier.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECPromoterGetCouponToHeadSupplierResponse> ExecuteChannelsECPromoterGetCouponToHeadSupplierAsync(this WechatApiClient client, Models.ChannelsECPromoterGetCouponToHeadSupplierRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "promoter", "get_coupon_to_headsupplier")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECPromoterGetCouponToHeadSupplierResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECPromoter/Feed

View File

@@ -12,6 +12,20 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[System.Text.Json.Serialization.JsonPropertyName("shop_appid")]
public string? ShopAppId { get; set; }
/// <summary>
/// 获取或设置是否来源于其他机构。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_from_head_supplier")]
[System.Text.Json.Serialization.JsonPropertyName("is_from_head_supplier")]
public bool? IsFromHeadSupplier { get; set; }
/// <summary>
/// 获取或设置来源的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
public string? FromHeadSupplierAppId { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>

View File

@@ -7,8 +7,22 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
public static class Types
{
public class Coupon : ChannelsECPromoterGetPublicCouponListResponse.Types.Coupon
public class Coupon
{
/// <summary>
/// 获取或设置券 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("coupon_id")]
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long CouponId { get; set; }
/// <summary>
/// 获取或设置来源的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
public string? FromHeadSupplierAppId { get; set; }
}
}

View File

@@ -5,6 +5,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
public class ChannelsECPromoterGetCouponDetailRequest : WechatApiRequest, IInferable<ChannelsECPromoterGetCouponDetailRequest, ChannelsECPromoterGetCouponDetailResponse>
{
/// <summary>
/// 获取或设置来源的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
public string? FromHeadSupplierAppId { get; set; }
/// <summary>
/// 获取或设置券 ID。
/// </summary>

View File

@@ -12,6 +12,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[System.Text.Json.Serialization.JsonPropertyName("sharer_appid")]
public string? SharerAppId { get; set; }
/// <summary>
/// 获取或设置来源的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
public string? FromHeadSupplierAppId { get; set; }
/// <summary>
/// 获取或设置券 ID。
/// </summary>

View File

@@ -12,6 +12,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[System.Text.Json.Serialization.JsonPropertyName("sharer_appid")]
public string? SharerAppId { get; set; }
/// <summary>
/// 获取或设置来源的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_head_supplier_appid")]
public string? FromHeadSupplierAppId { get; set; }
/// <summary>
/// 获取或设置券 ID。
/// </summary>

View File

@@ -0,0 +1,30 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的请求。</para>
/// </summary>
public class ChannelsECPromoterGetCouponToHeadSupplierRequest : WechatApiRequest, IInferable<ChannelsECPromoterGetCouponToHeadSupplierRequest, ChannelsECPromoterGetCouponToHeadSupplierResponse>
{
/// <summary>
/// 获取或设置接收的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
public string ToHeadSupplierAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; }
/// <summary>
/// 获取或设置分页游标。
/// </summary>
[Newtonsoft.Json.JsonProperty("page_context")]
[System.Text.Json.Serialization.JsonPropertyName("page_context")]
public string? Cursor { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/promoter/get_coupon_to_headsupplier 接口的响应。</para>
/// </summary>
public class ChannelsECPromoterGetCouponToHeadSupplierResponse : WechatApiResponse
{
public static class Types
{
public class Coupon
{
/// <summary>
/// 获取或设置券 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("coupon_id")]
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long CouponId { get; set; }
/// <summary>
/// 获取或设置接收的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
public string ToHeadSupplierAppId { get; set; } = default!;
/// <summary>
/// 获取或设置发放时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("give_time")]
[System.Text.Json.Serialization.JsonPropertyName("give_time")]
public long GiveTimestamp { get; set; }
}
}
/// <summary>
/// 获取或设置券列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Coupon[] CouponList { get; set; } = default!;
/// <summary>
/// 获取或设置总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
public int TotalCount { get; set; }
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("page_context")]
[System.Text.Json.Serialization.JsonPropertyName("page_context")]
public string? NextCursor { get; set; }
}
}

View File

@@ -15,7 +15,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[Newtonsoft.Json.JsonProperty("coupon_id")]
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long CouponId { get; set; }
public long CouponId { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口的请求。</para>
/// </summary>
public class ChannelsECPromoterSetCouponToHeadSupplierRequest : WechatApiRequest, IInferable<ChannelsECPromoterSetCouponToHeadSupplierRequest, ChannelsECPromoterSetCouponToHeadSupplierResponse>
{
/// <summary>
/// 获取或设置接收的机构 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("to_head_supplier_appid")]
[System.Text.Json.Serialization.JsonPropertyName("to_head_supplier_appid")]
public string ToHeadSupplierAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置券 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("coupon_id")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.TextualNumberConverter))]
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.WriteAsString)]
public long CouponId { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/promoter/set_coupon_to_headsupplier 接口的响应。</para>
/// </summary>
public class ChannelsECPromoterSetCouponToHeadSupplierResponse : WechatApiResponse
{
}
}

View File

@@ -0,0 +1,5 @@
{
"to_head_supplier_appid": "wxdfsdxxxxx",
"limit": 10,
"page_context": "CAEQARgfKj0AACcYl2AAABQBAgQAXFE1wJCeiAAA"
}

View File

@@ -0,0 +1,13 @@
{
"errcode": 0,
"errmsg": "success",
"list": [
{
"coupon_id": "23234",
"to_head_supplier_appid": "wxsdsdfsds",
"give_time": 1761767465
}
],
"page_context": "CAEQARgfKj0AACcYl2AAABQBAgQAXFE1wJCeiAAA",
"total_count": 100
}

View File

@@ -0,0 +1,4 @@
{
"to_head_supplier_appid": "wxab1eaxxxxxx",
"coupon_id": "121432"
}