Browse Source

修复单sku宝贝添加不成功

master
С·æ 4 years ago
parent
commit
115997d1d8
  1. 19
      JdShopListener/JdShopListener/MainWindowViewModel.cs

19
JdShopListener/JdShopListener/MainWindowViewModel.cs

@ -10,6 +10,7 @@ using JdShopListener.SqlHelpers;
using System.Windows; using System.Windows;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using Newtonsoft.Json.Linq;
namespace JdShopListener namespace JdShopListener
{ {
@ -26,8 +27,6 @@ namespace JdShopListener
} }
public MainWindowViewModel() { public MainWindowViewModel() {
ProList = new System.Collections.ObjectModel.ObservableCollection<ProModel>() { ProList = new System.Collections.ObjectModel.ObservableCollection<ProModel>() {
new ProModel(){ Name="价格" , Type= ProType.Price}, new ProModel(){ Name="价格" , Type= ProType.Price},
@ -227,25 +226,27 @@ namespace JdShopListener
{ {
var detail = GetItemDetail(Sku); var detail = GetItemDetail(Sku);
var list = detail.product.colorSize; JArray list = detail.product.colorSize as JArray;
//spuId //spuId
string spuId = detail.product.mainSkuId; string spuId = detail.product.mainSkuId;
//if (list.Count == 0 || list.Count == null) if (list==null||list.Count == 0)
//{ {
// list.Add(new { skuId = Sku }); list = new JArray();
//} list.Add(JToken.FromObject(new { skuId=Sku }));
}
List<SkuModel> skus = new List<SkuModel>(); List<SkuModel> skus = new List<SkuModel>();
foreach (var sku in list)
foreach (JObject sku in list)
{ {
SkuModel model = new SkuModel() SkuModel model = new SkuModel()
{ {
Desc = Desc, Desc = Desc,
SkuId = sku.skuId, SkuId = sku["skuId"].ToString(),
SpuId = spuId SpuId = spuId
}; };

Loading…
Cancel
Save