From 779ce9afe5e25a229e632fef3f087d5948355305 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Tue, 31 Oct 2023 10:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8A=E6=9E=B6=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E6=B2=A1=E6=9C=89skuId=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformSDK/JDBusiness.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 2ad5f268..a4f05ae2 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -1110,6 +1110,33 @@ namespace BBWY.Server.Business stepText = "获取上架skuId"; var newSkuIdList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value("skuId")).ToList(); + + #region 处理上架之后没有skuId的情况 + if (newSkuIdList.Any(s => string.IsNullOrEmpty(s))) + { + newSkuIdList.Clear(); + Thread.Sleep(30 * 1000); + var _mainProductSkuList = GetProductSkuList(new SearchProductSkuRequest() + { + AppKey = request.AppKey, + AppSecret = request.AppSecret, + AppToken = request.AppToken, + Platform = Enums.Platform.京东, + Spu = request.MainProductSpu + }); + foreach (var ps in _mainProductSkuList) + { + if (request.GiftTemplateSkuList.Any(x => x.Title == ps.Title)) + { + //此sku是赠品sku + newSkuIdList.Add(ps.Id); + } + } + if (newSkuIdList.Count() == 0) + throw new BusinessException("未能从sku列表接口正常获取新上架sku"); + } + #endregion + giftSkuIdList.AddRange(newSkuIdList); stepText = "获取上架sku";