From add0a607f7ef273cc93bacaebee43d0a7c13e76c Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 31 Jan 2025 23:55:24 +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=E5=85=8D=E5=AE=A1=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...echatApiClientExecuteChannelsExtensions.cs | 23 ++ .../ECProduct/ChannelsECProductAddRequest.cs | 4 +- .../ChannelsECProductAuditFreeRequest.cs | 238 ++++++++++++++++++ .../ChannelsECProductAuditFreeResponse.cs | 9 + .../ChannelsECProductAuditFreeRequest.json | 17 ++ 5 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ChannelsECProductAuditFreeRequest.json diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index 91bfe79a..3e213156 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -3821,6 +3821,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); } + /// + /// 异步调用 [POST] /channels/ec/product/auditfree 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteChannelsECProductAuditFreeAsync(this WechatApiClient client, Models.ChannelsECProductAuditFreeRequest 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", "auditfree") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + /// /// 异步调用 [POST] /channels/ec/product/audit/cancel 接口。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAddRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAddRequest.cs index 6203f9b4..c4a06f23 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAddRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAddRequest.cs @@ -147,14 +147,14 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models public int FullPaymentPresaleDeliveryType { get; set; } /// - /// 获取或设置 SKU 预售周期开始时间。 + /// 获取或设置 SKU 预售周期开始时间戳。 /// [Newtonsoft.Json.JsonProperty("presale_begin_time")] [System.Text.Json.Serialization.JsonPropertyName("presale_begin_time")] public long PresaleBeginTimestamp { get; set; } /// - /// 获取或设置 SKU 预售周期结束时间。 + /// 获取或设置 SKU 预售周期结束时间戳。 /// [Newtonsoft.Json.JsonProperty("presale_end_time")] [System.Text.Json.Serialization.JsonPropertyName("presale_end_time")] diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeRequest.cs new file mode 100644 index 00000000..45128f2c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeRequest.cs @@ -0,0 +1,238 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/auditfree 接口的请求。 + /// + public class ChannelsECProductAuditFreeRequest : WechatApiRequest, IInferable + { + public static class Types + { + public class SKU + { + public static class Types + { + public class StockInfo + { + /// + /// 获取或设置修改类型。 + /// + [Newtonsoft.Json.JsonProperty("diff_type")] + [System.Text.Json.Serialization.JsonPropertyName("diff_type")] + public int? DiffType { get; set; } + + /// + /// 获取或设置修改数量。 + /// + [Newtonsoft.Json.JsonProperty("num")] + [System.Text.Json.Serialization.JsonPropertyName("num")] + public int DiffCount { get; set; } + } + + public class SKUDeliverInfo + { + /// + /// 获取或设置 SKU 库存情况。 + /// + [Newtonsoft.Json.JsonProperty("stock_type")] + [System.Text.Json.Serialization.JsonPropertyName("stock_type")] + public int StockType { get; set; } + + /// + /// 获取或设置 SKU 发货节点。 + /// + [Newtonsoft.Json.JsonProperty("full_payment_presale_delivery_type")] + [System.Text.Json.Serialization.JsonPropertyName("full_payment_presale_delivery_type")] + public int? FullPaymentPresaleDeliveryType { get; set; } + + /// + /// 获取或设置 SKU 预售周期开始时间戳。 + /// + [Newtonsoft.Json.JsonProperty("presale_begin_time")] + [System.Text.Json.Serialization.JsonPropertyName("presale_begin_time")] + public long? PresaleBeginTimestamp { get; set; } + + /// + /// 获取或设置 SKU 预售周期结束时间戳。 + /// + [Newtonsoft.Json.JsonProperty("presale_end_time")] + [System.Text.Json.Serialization.JsonPropertyName("presale_end_time")] + public long? PresaleEndTimestamp { get; set; } + + /// + /// 获取或设置 SKU 发货时效。 + /// + [Newtonsoft.Json.JsonProperty("full_payment_presale_delivery_time")] + [System.Text.Json.Serialization.JsonPropertyName("full_payment_presale_delivery_time")] + public int FullPaymentPresaleDeliveryTime { get; set; } + } + } + + /// + /// 获取或设置 SKU ID。 + /// + [Newtonsoft.Json.JsonProperty("sku_id")] + [System.Text.Json.Serialization.JsonPropertyName("sku_id")] + public long SKUId { get; set; } + + /// + /// 获取或设置商品编码。 + /// + [Newtonsoft.Json.JsonProperty("sku_code")] + [System.Text.Json.Serialization.JsonPropertyName("sku_code")] + public string? SKUCode { get; set; } + + /// + /// 获取或设置售价(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("sale_price")] + [System.Text.Json.Serialization.JsonPropertyName("sale_price")] + public int? SalePrice { get; set; } + + /// + /// 获取或设置库存信息。 + /// + [Newtonsoft.Json.JsonProperty("stock_info")] + [System.Text.Json.Serialization.JsonPropertyName("stock_info")] + public Types.StockInfo? StockInfo { get; set; } + + /// + /// 获取或设置商品配送信息。 + /// + [Newtonsoft.Json.JsonProperty("sku_deliver_info")] + [System.Text.Json.Serialization.JsonPropertyName("sku_deliver_info")] + public Types.SKUDeliverInfo? SKUDeliverInfo { get; set; } + + /// + /// 获取或设置是否删除。 + /// + [Newtonsoft.Json.JsonProperty("is_delete")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_delete")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanConverter))] + public bool? IsDeleted { get; set; } + } + + public class Limitation + { + /// + /// 获取或设置限购周期类型。 + /// + [Newtonsoft.Json.JsonProperty("period_type")] + [System.Text.Json.Serialization.JsonPropertyName("period_type")] + public int? PeriodType { get; set; } + + /// + /// 获取或设置限购数量。 + /// + [Newtonsoft.Json.JsonProperty("limited_buy_num")] + [System.Text.Json.Serialization.JsonPropertyName("limited_buy_num")] + public int? LimitedBuyCount { get; set; } + } + + public class Express + { + /// + /// 获取或设置运费模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("template_id")] + [System.Text.Json.Serialization.JsonPropertyName("template_id")] + public long? TemplateId { get; set; } + + /// + /// 获取或设置商品重量(单位:克)。 + /// + [Newtonsoft.Json.JsonProperty("weight")] + [System.Text.Json.Serialization.JsonPropertyName("weight")] + public int? Weight { get; set; } + } + + public class ExtraService + { + /// + /// 获取或设置是否支持七天无理由退货。 + /// + [Newtonsoft.Json.JsonProperty("seven_day_return")] + [System.Text.Json.Serialization.JsonPropertyName("seven_day_return")] + public int? SevenDayReturn { get; set; } + + /// + /// 获取或设置是否支持运费险。 + /// + [Newtonsoft.Json.JsonProperty("freight_insurance")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("freight_insurance")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanConverter))] + public bool? IsFreightInsuranceSupported { get; set; } + + /// + /// 获取或设置是否支持假一赔三。 + /// + [Newtonsoft.Json.JsonProperty("fake_one_pay_three")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("fake_one_pay_three")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanConverter))] + public bool? IsFakeOnePayThreeSupported { get; set; } + + /// + /// 获取或设置是否支持坏损包退。 + /// + [Newtonsoft.Json.JsonProperty("damage_guarantee")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.NumericalBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("damage_guarantee")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalBooleanConverter))] + public bool? IsDamageGuaranteeSupported { get; set; } + } + } + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public long ProductId { get; set; } + + /// + /// 获取或设置商品编码。 + /// + [Newtonsoft.Json.JsonProperty("spu_code")] + [System.Text.Json.Serialization.JsonPropertyName("spu_code")] + public string? SpuCode { get; set; } + + /// + /// 获取或设置 SKU 列表。 + /// + [Newtonsoft.Json.JsonProperty("skus")] + [System.Text.Json.Serialization.JsonPropertyName("skus")] + public IList? SKUList { get; set; } = new List(); + + /// + /// 获取或设置发货方式。 + /// + [Newtonsoft.Json.JsonProperty("deliver_method")] + [System.Text.Json.Serialization.JsonPropertyName("deliver_method")] + public int? DeliverMethod { get; set; } + + /// + /// 获取或设置运费信息。 + /// + [Newtonsoft.Json.JsonProperty("express_info")] + [System.Text.Json.Serialization.JsonPropertyName("express_info")] + public Types.Express? Express { get; set; } + + /// + /// 获取或设置限购信息。 + /// + [Newtonsoft.Json.JsonProperty("limited_info")] + [System.Text.Json.Serialization.JsonPropertyName("limited_info")] + public Types.Limitation? Limitation { get; set; } + + /// + /// 获取或设置额外的服务信息。 + /// + [Newtonsoft.Json.JsonProperty("extra_service")] + [System.Text.Json.Serialization.JsonPropertyName("extra_service")] + public Types.ExtraService? ExtraService { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeResponse.cs new file mode 100644 index 00000000..9a66f00c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECProduct/ChannelsECProductAuditFreeResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/product/auditfree 接口的响应。 + /// + public class ChannelsECProductAuditFreeResponse : WechatApiResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ChannelsECProductAuditFreeRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ChannelsECProductAuditFreeRequest.json new file mode 100644 index 00000000..8e401ed8 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECProduct/ChannelsECProductAuditFreeRequest.json @@ -0,0 +1,17 @@ +{ + "product_id": "12345466", + "skus": [ + { + "sku_id": "1234565", + "sku_code": "SKU_1", + "sale_price": 1000, + "sku_deliver_info": {} + }, + { + "sku_id": "1234557", + "is_delete": true + } + ], + "spu_code": "SPU_123", + "limited_info": {} +}