From 3466c65569c23b549bf8aae71161349df8ea6df0 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Thu, 27 Nov 2025 15:36:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=B0=8F=E5=BA=97=E7=AB=99=E5=86=85=E5=A4=96=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=B1=9E=E6=80=A7=E6=98=A0=E5=B0=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...echatApiClientExecuteChannelsExtensions.cs | 25 +++++++++++++ ...ctCategoryExternalProductMappingRequest.cs | 36 +++++++++++++++++++ ...tCategoryExternalProductMappingResponse.cs | 36 +++++++++++++++++++ ...CategoryExternalProductMappingRequest.json | 6 ++++ ...ategoryExternalProductMappingResponse.json | 8 +++++ 5 files changed, 111 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index fd9d73bb..aec40d22 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -5408,6 +5408,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api } #endregion + #region ECProduct/ExternalProduct + /// + /// 异步调用 [POST] /channels/ec/product/externalproductmapping 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECProductCategoryExternalProductMappingAsync(this WechatApiClient client, Models.ChannelsECProductCategoryExternalProductMappingRequest 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", "externalproductmapping") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + #endregion + #region ECProduct/Gift /// /// 异步调用 [POST] /channels/ec/product/gift/add 接口。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs new file mode 100644 index 00000000..afab1eb6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/externalproductmapping 接口的请求。 + /// + public class ChannelsECProductCategoryExternalProductMappingRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置商品类目 ID。 + /// + [Newtonsoft.Json.JsonProperty("cat_id")] + [System.Text.Json.Serialization.JsonPropertyName("cat_id")] + public long CategoryId { get; set; } + + /// + /// 获取或设置外部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_name")] + public string? ExternalAttributeName { get; set; } + + /// + /// 获取或设置外部商品属性值。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_value")] + public string? ExternalAttributeValue { get; set; } + + /// + /// 获取或设置外部商品类目名称。 + /// + [Newtonsoft.Json.JsonProperty("external_category_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_category_name")] + public string? ExternalCategoryName { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs new file mode 100644 index 00000000..158cff44 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/externalproductmapping 接口的响应。 + /// + public class ChannelsECProductCategoryExternalProductMappingResponse : WechatApiResponse + { + /// + /// 获取或设置外部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_name")] + public string? ExternalAttributeName { get; set; } + + /// + /// 获取或设置外部商品属性值。 + /// + [Newtonsoft.Json.JsonProperty("external_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("external_attribute_value")] + public string? ExternalAttributeValue { get; set; } + + /// + /// 获取或设置内部商品属性键。 + /// + [Newtonsoft.Json.JsonProperty("internal_attribute_name")] + [System.Text.Json.Serialization.JsonPropertyName("internal_attribute_name")] + public string? InternalAttributeName { get; set; } + + /// + /// 获取或设置内部商品属性值列表。 + /// + [Newtonsoft.Json.JsonProperty("internal_attribute_value")] + [System.Text.Json.Serialization.JsonPropertyName("internal_attribute_value")] + public string[]? InternalAttributeValueList { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json new file mode 100644 index 00000000..ca56bf6d --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingRequest.json @@ -0,0 +1,6 @@ +{ + "cat_id": 6261, + "external_attribute_name": "帮面材质", + "external_attribute_value": "塑胶", + "external_category_name": "母婴:童鞋:雨鞋" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json new file mode 100644 index 00000000..cd7308fa --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ExternalProduct/ChannelsECProductCategoryExternalProductMappingResponse.json @@ -0,0 +1,8 @@ +{ + "errcode": 0, + "errmsg": "ok", + "external_attribute_name": "帮面材质", + "external_attribute_value": "塑胶", + "internal_attribute_name": "鞋面材质", + "internal_attribute_value": [ "塑胶" ] +}