Browse Source

处理上架之后没有skuId的情况

AddValidOverTime
shanji 2 years ago
parent
commit
779ce9afe5
  1. 27
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs

27
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -1110,6 +1110,33 @@ namespace BBWY.Server.Business
stepText = "获取上架skuId"; stepText = "获取上架skuId";
var newSkuIdList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value<string>("skuId")).ToList(); var newSkuIdList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value<string>("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); giftSkuIdList.AddRange(newSkuIdList);
stepText = "获取上架sku"; stepText = "获取上架sku";

Loading…
Cancel
Save