|
|
@ -1058,7 +1058,6 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
else if (res.Json["jingdong_category_read_findSaleAttrTemplates_responce"]["categoryAttrTemplates"]["templateType"].ToString() == "2") |
|
|
|
{ |
|
|
|
isStruts = true; |
|
|
|
var tempDataJarray = JArray.Parse(res.Json["jingdong_category_read_findSaleAttrTemplates_responce"]["categoryAttrTemplates"]["templateData"].ToString()); |
|
|
|
var tempDataJToken = tempDataJarray.FirstOrDefault(j => j.Value<string>("valueRules").Contains("颜色") || |
|
|
|
j.Value<string>("valueRules").Contains("款式") || |
|
|
@ -1066,33 +1065,36 @@ namespace BBWY.Server.Business |
|
|
|
if (tempDataJToken == null) |
|
|
|
{ |
|
|
|
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, giftSkuIdList, request.MainProductSpu, request.FullTitle, brandName, haveGiftTemplateSku); |
|
|
|
throw new BusinessException("缺少结构化属性-颜色"); |
|
|
|
throw new BusinessException("缺少必要的结构化属性"); |
|
|
|
} |
|
|
|
attrId = tempDataJToken.Value<string>("attrId"); |
|
|
|
var tempDataValuesJToken = JObject.Parse(tempDataJToken["valueRules"].ToString()); |
|
|
|
var tempDataValues_Level1_JToken = tempDataValuesJToken["items"][0]; |
|
|
|
if (tempDataValuesJToken["items"].Count() == 3 && |
|
|
|
tempDataValuesJToken["items"][0]["properties"]["id"]["type"].ToString() == "model" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["value"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][2]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][2]["properties"]["value"]["type"].ToString() == "string") |
|
|
|
if (tempDataJToken.Value<string>("type") == "1") |
|
|
|
{ |
|
|
|
var f_id = int.Parse(tempDataValuesJToken["items"][0]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var f_tempJarray = tempDataValuesJToken["items"][0]["properties"]["value"]["enum"][0]["preprocessingSaleAttrValTemplateValueList"] as JArray; |
|
|
|
var f_value = f_tempJarray.FirstOrDefault().Value<string>("name"); |
|
|
|
var f_valueId = f_tempJarray.FirstOrDefault().Value<int>("id"); |
|
|
|
isStruts = true; |
|
|
|
var tempDataValuesJToken = JObject.Parse(tempDataJToken["valueRules"].ToString()); |
|
|
|
var tempDataValues_Level1_JToken = tempDataValuesJToken["items"][0]; |
|
|
|
if (tempDataValuesJToken["items"].Count() == 3 && |
|
|
|
tempDataValuesJToken["items"][0]["properties"]["id"]["type"].ToString() == "model" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["value"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][2]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][2]["properties"]["value"]["type"].ToString() == "string") |
|
|
|
{ |
|
|
|
var f_id = int.Parse(tempDataValuesJToken["items"][0]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var f_tempJarray = tempDataValuesJToken["items"][0]["properties"]["value"]["enum"][0]["preprocessingSaleAttrValTemplateValueList"] as JArray; |
|
|
|
var f_value = f_tempJarray.FirstOrDefault().Value<string>("name"); |
|
|
|
var f_valueId = f_tempJarray.FirstOrDefault().Value<int>("id"); |
|
|
|
|
|
|
|
var s_id = int.Parse(tempDataValuesJToken["items"][1]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var s_unit = tempDataValuesJToken["items"][1]["properties"]["unit"]["enum"][0].ToString(); |
|
|
|
//var s_value = "1";
|
|
|
|
var s_id = int.Parse(tempDataValuesJToken["items"][1]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var s_unit = tempDataValuesJToken["items"][1]["properties"]["unit"]["enum"][0].ToString(); |
|
|
|
//var s_value = "1";
|
|
|
|
|
|
|
|
var t_id = int.Parse(tempDataValuesJToken["items"][2]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var t_value = "待替换的备注"; |
|
|
|
var t_id = int.Parse(tempDataValuesJToken["items"][2]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var t_value = "待替换的备注"; |
|
|
|
|
|
|
|
for (var i = 0; i < request.GiftTemplateSkuList.Count(); i++) |
|
|
|
{ |
|
|
|
strutsSaleAttrValueList.Add(new List<AttrValueAliasJson>() |
|
|
|
for (var i = 0; i < request.GiftTemplateSkuList.Count(); i++) |
|
|
|
{ |
|
|
|
strutsSaleAttrValueList.Add(new List<AttrValueAliasJson>() |
|
|
|
{ |
|
|
|
new AttrValueAliasJson() |
|
|
|
{ |
|
|
@ -1114,13 +1116,13 @@ namespace BBWY.Server.Business |
|
|
|
isReName = true |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (tempDataValues_Level1_JToken["properties"]["id"]["type"].ToString() == "model") |
|
|
|
{ |
|
|
|
//[{\"id\":5,\"unit\":\"\",\"value\":\"红色\","valueId":1234567}]
|
|
|
|
var tempJarray = tempDataValues_Level1_JToken["properties"]["value"]["enum"][0]["preprocessingSaleAttrValTemplateValueList"] as JArray; |
|
|
|
strutsSaleAttrValueList.AddRange(tempJarray.Select(j => new List<AttrValueAliasJson>() |
|
|
|
else if (tempDataValues_Level1_JToken["properties"]["id"]["type"].ToString() == "model") |
|
|
|
{ |
|
|
|
//[{\"id\":5,\"unit\":\"\",\"value\":\"红色\","valueId":1234567}]
|
|
|
|
var tempJarray = tempDataValues_Level1_JToken["properties"]["value"]["enum"][0]["preprocessingSaleAttrValTemplateValueList"] as JArray; |
|
|
|
strutsSaleAttrValueList.AddRange(tempJarray.Select(j => new List<AttrValueAliasJson>() |
|
|
|
{ |
|
|
|
new AttrValueAliasJson |
|
|
|
{ |
|
|
@ -1131,17 +1133,17 @@ namespace BBWY.Server.Business |
|
|
|
isReName = true |
|
|
|
} |
|
|
|
})); |
|
|
|
} |
|
|
|
else if (tempDataValues_Level1_JToken["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValues_Level1_JToken["properties"]["value"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["value"]["type"].ToString() == "string") |
|
|
|
{ |
|
|
|
var f_id = int.Parse(tempDataValues_Level1_JToken["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var f_unit = tempDataValues_Level1_JToken["properties"]["unit"]["enum"][0].ToString(); |
|
|
|
var s_id = int.Parse(tempDataValuesJToken["items"][1]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
} |
|
|
|
else if (tempDataValues_Level1_JToken["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValues_Level1_JToken["properties"]["value"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["id"]["type"].ToString() == "number" && |
|
|
|
tempDataValuesJToken["items"][1]["properties"]["value"]["type"].ToString() == "string") |
|
|
|
{ |
|
|
|
var f_id = int.Parse(tempDataValues_Level1_JToken["properties"]["id"]["enum"][0].ToString()); |
|
|
|
var f_unit = tempDataValues_Level1_JToken["properties"]["unit"]["enum"][0].ToString(); |
|
|
|
var s_id = int.Parse(tempDataValuesJToken["items"][1]["properties"]["id"]["enum"][0].ToString()); |
|
|
|
|
|
|
|
strutsSaleAttrValueList.AddRange(request.GiftTemplateSkuList.Select(x => new List<AttrValueAliasJson>() |
|
|
|
strutsSaleAttrValueList.AddRange(request.GiftTemplateSkuList.Select(x => new List<AttrValueAliasJson>() |
|
|
|
{ |
|
|
|
new AttrValueAliasJson() |
|
|
|
{ |
|
|
@ -1157,9 +1159,10 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
throw new BusinessException($"不支持的properties.id.type {tempDataValues_Level1_JToken["properties"]["id"]["type"]} 或取其分支情况"); |
|
|
|
} |
|
|
|
else |
|
|
|
throw new BusinessException($"不支持的properties.id.type {tempDataValues_Level1_JToken["properties"]["id"]["type"]} 或取其分支情况"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|