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

Loading…
Cancel
Save