Browse Source

修复1688爬虫取图问题

qianyi
shanji 3 years ago
parent
commit
8c3f789af2
  1. 15
      BBWY.Client/APIServices/PurchaseProductAPIService.cs

15
BBWY.Client/APIServices/PurchaseProductAPIService.cs

@ -199,11 +199,14 @@ namespace BBWY.Client.APIServices
Location = jobject["data"]["1081181309101"]["data"]["location"].ToString() Location = jobject["data"]["1081181309101"]["data"]["location"].ToString()
}; };
var colors3216 = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value<int>("fid") == 3216)["value"].Children().Select(j => new var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value<int>("fid") == 3216 &&
{ j.Value<int>("fid") == 1627207)["value"]
name = j.Value<string>("name"), .Children()
imageUrl = j.Value<string>("imageUrl") .Select(j => new
}).ToList(); {
name = j.Value<string>("name"),
imageUrl = j.Value<string>("imageUrl")
}).ToList();
var firstPrice = jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value<decimal>("price"); var firstPrice = jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value<decimal>("price");
@ -227,7 +230,7 @@ namespace BBWY.Client.APIServices
Title = name, Title = name,
PurchaseSkuId = value.Value<string>("skuId"), PurchaseSkuId = value.Value<string>("skuId"),
PurchaseSkuSpecId = value.Value<string>("specId"), PurchaseSkuSpecId = value.Value<string>("specId"),
Logo = colors3216.FirstOrDefault(c => c.name == matchName)?.imageUrl ?? "pack://application:,,,/Resources/Images/defaultItem.png" Logo = colorsProperty.FirstOrDefault(c => c.name == matchName)?.imageUrl ?? "pack://application:,,,/Resources/Images/defaultItem.png"
}); });
} }

Loading…
Cancel
Save