feat(wxapi): 新增微信小店商品发品前校验接口

This commit is contained in:
Fu Diwei
2025-11-27 15:36:31 +08:00
parent 34439beb41
commit 215c80e15c
5 changed files with 69 additions and 0 deletions

View File

@@ -5571,6 +5571,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECProductCategoryClassifyResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/product/categoryprecheck 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/channels-shop-product/shop/api_categoryprecheck.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECProductCategoryPrecheckResponse> ExecuteChannelsECProductCategoryPrecheckAsync(this WechatApiClient client, Models.ChannelsECProductCategoryPrecheckRequest 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", "product", "categoryprecheck")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECProductCategoryPrecheckResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECProduct/ExternalProduct

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/product/categoryprecheck 接口的请求。</para>
/// </summary>
public class ChannelsECProductCategoryPrecheckRequest : WechatApiRequest, IInferable<ChannelsECProductCategoryPrecheckRequest, ChannelsECProductCategoryPrecheckResponse>
{
/// <summary>
/// 获取或设置商品类目 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("cat_id")]
[System.Text.Json.Serialization.JsonPropertyName("cat_id")]
public long? CategoryId { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/product/categoryprecheck 接口的响应。</para>
/// </summary>
public class ChannelsECProductCategoryPrecheckResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置是否类目全部校验通过。
/// </summary>
[Newtonsoft.Json.JsonProperty("all_pass")]
[System.Text.Json.Serialization.JsonPropertyName("all_pass")]
public bool IsAllPass { get; set; }
/// <summary>
/// 获取或设置校验不通过的原因列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_reasons")]
[System.Text.Json.Serialization.JsonPropertyName("fail_reasons")]
public string[]? FailReasonList { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"all_pass": true,
"fail_reasons": []
}