Browse Source

修复sku saleAttrs缺少的问题

qianyi
shanji 3 years ago
parent
commit
c8a53efa0f
  1. 10
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs

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

@ -132,20 +132,12 @@ namespace BBWY.Server.Business
if (rep_skuList.IsError)
throw new BusinessException(string.IsNullOrEmpty(rep_skuList.ErrorMsg) ? rep_skuList.ErrMsg : rep_skuList.ErrorMsg);
if (rep_skuList.Json == null ||
!rep_skuList.Json.ContainsKey("jingdong_sku_read_searchSkuList_responce") ||
rep_skuList.Json["jingdong_sku_read_searchSkuList_responce"]["page"] == null ||
rep_skuList.Json["jingdong_sku_read_searchSkuList_responce"]["page"]["data"] == null)
{
return new ProductSkuResponse[0];
}
return ((JArray)rep_skuList.Json["jingdong_sku_read_searchSkuList_responce"]["page"]["data"]).Select(s => new ProductSkuResponse()
{
Id = s.Value<string>("skuId"),
ProductId = s.Value<string>("wareId"),
Price = s.Value<decimal>("jdPrice"),
Title = string.Join("-", s["saleAttrs"].Select(a => a["attrValueAlias"][0].ToString())),
Title = s["saleAttrs"] != null ? string.Join("-", s["saleAttrs"].Select(a => a["attrValueAlias"][0].ToString())) : string.Empty,
Logo = $"https://img13.360buyimg.com/n9/s80x80_{s.Value<string>("logo")}",
State = s.Value<int>("status"),
CreateTime = s.Value<long>("created").StampToDateTime()

Loading…
Cancel
Save