feat(wxapi): 新增微信小店类目规则相关接口

This commit is contained in:
Fu Diwei
2026-01-04 19:44:23 +08:00
parent 1bdb61a23a
commit caf59ec236
6 changed files with 108 additions and 0 deletions

View File

@@ -351,6 +351,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ShopCategoryGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /shop/ec/category/getcategoryrule 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/category-rule/api_get_category_rule.html ]]> <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/category-rule/api_get_delivery_method_category_rule.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ShopECCategoryGetCategoryRuleResponse> ExecuteShopECCategoryGetCategoryRuleAsync<TResponse>(this WechatApiClient client, Models.ShopECCategoryGetCategoryRuleRequest 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, "shop", "ec", "category", "getcategoryrule")
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("rule_id", request.RuleId);
return await client.SendFlurlRequestAsJsonAsync<Models.ShopECCategoryGetCategoryRuleResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region Complaint

View File

@@ -1,3 +1,5 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
@@ -144,6 +146,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// <summary>
/// 获取或设置发货前成交退款率(单位:百分数)。
/// </summary>
[Obsolete("相关接口或字段于 2025-11-28 下线。")]
[Newtonsoft.Json.JsonProperty("pay_refund_before_send_ratio")]
[System.Text.Json.Serialization.JsonPropertyName("pay_refund_before_send_ratio")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /shop/ec/category/getcategoryrule 接口的请求。</para>
/// </summary>
public class ShopECCategoryGetCategoryRuleRequest : WechatApiRequest, IInferable<ShopECCategoryGetCategoryRuleRequest, ShopECCategoryGetCategoryRuleResponse>
{
/// <summary>
/// 获取或设置规则 ID。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int RuleId { get; set; }
/// <summary>
/// 获取或设置类目 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("category_id")]
[System.Text.Json.Serialization.JsonPropertyName("category_id")]
public long CategoryId { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /shop/ec/category/getcategoryrule 接口的响应。</para>
/// </summary>
public class ShopECCategoryGetCategoryRuleResponse : WechatApiResponse
{
public static class Types
{
public class Deliver
{
/// <summary>
/// 获取或设置发货方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("deliver_type")]
[System.Text.Json.Serialization.JsonPropertyName("deliver_type")]
public int DeliverType { get; set; }
/// <summary>
/// 获取或设置支持的账号类型列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("acct_type")]
[System.Text.Json.Serialization.JsonPropertyName("acct_type")]
public int[] AccountTypeList { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置保证金(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("deposit")]
[System.Text.Json.Serialization.JsonPropertyName("deposit")]
public int? Deposit { get; set; }
/// <summary>
/// 获取或设置发货方式列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Deliver[]? DeliverList { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
{
"list": [
{
"deliver_type": 0,
"acct_type": [
0
]
}
],
"deposit": 1000000,
"errcode": 0,
"errmsg": ""
}