From 4b9b0fa7edc4efea8ff2dfcafc8436b4ee5a5b46 Mon Sep 17 00:00:00 2001 From: sanji Date: Wed, 29 Nov 2023 16:40:46 +0800 Subject: [PATCH] =?UTF-8?q?pjzs=20number=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.JDSDK/Request/AttrValueAliasJson.cs | 2 + .../PlatformSDK/JDBusiness.cs | 50 +++++++++++++++---- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/BBWY.JDSDK/Request/AttrValueAliasJson.cs b/BBWY.JDSDK/Request/AttrValueAliasJson.cs index 7c326401..be14914c 100644 --- a/BBWY.JDSDK/Request/AttrValueAliasJson.cs +++ b/BBWY.JDSDK/Request/AttrValueAliasJson.cs @@ -9,5 +9,7 @@ public string value { get; set; } public int? valueId { get; set; } + + public bool isReName { get; set; } } } diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index f080ddf6..705dc6f7 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -1011,7 +1011,7 @@ namespace BBWY.Server.Business // } // colorSaleAttrs = colorProperty["attrValueList"].ToList(); //} - List strutsSaleAttrValueList = new List(); + List> strutsSaleAttrValueList = new List>(); var isStruts = false; { var req = new CategoryReadFindSaleAttrTemplatesRequest(); @@ -1057,16 +1057,46 @@ namespace BBWY.Server.Business { //[{\"id\":5,\"unit\":\"\",\"value\":\"红色\","valueId":1234567}] var tempJarray = tempDataValues_Level1_JToken["properties"]["value"]["enum"][0]["preprocessingSaleAttrValTemplateValueList"] as JArray; - strutsSaleAttrValueList.AddRange(tempJarray.Select(j => new AttrValueAliasJson + strutsSaleAttrValueList.AddRange(tempJarray.Select(j => new List() { - id = int.Parse(tempDataValues_Level1_JToken["properties"]["id"]["enum"][0].ToString()), - value = j.Value("name"), - valueId = j.Value("id"), - unit = string.Empty + new AttrValueAliasJson + { + id = int.Parse(tempDataValues_Level1_JToken["properties"]["id"]["enum"][0].ToString()), + value = j.Value("name"), + valueId = j.Value("id"), + unit = string.Empty, + 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()); + + strutsSaleAttrValueList.AddRange(request.GiftTemplateSkuList.Select(x => new List() + { + new AttrValueAliasJson() + { + id = f_id, + value = "1", + unit = f_unit + }, + new AttrValueAliasJson() + { + id = s_id, + value = "待替换的备注", + isReName = true + } + })); + + } else - throw new BusinessException($"不支持的properties.id.type {tempDataValues_Level1_JToken["properties"]["id"]["type"]}"); + throw new BusinessException($"不支持的properties.id.type {tempDataValues_Level1_JToken["properties"]["id"]["type"]} 或取其分支情况"); } } #endregion @@ -1131,9 +1161,9 @@ namespace BBWY.Server.Business var attrValueAlias = string.Empty; if (isStruts) { - var value = strutsSaleAttrValueList[skuIndex]; - value.value = giftSku.Title; - attrValueAlias = JsonConvert.SerializeObject(new object[] { value }); + var values = strutsSaleAttrValueList[skuIndex]; + values.FirstOrDefault(v => v.isReName).value = giftSku.Title; + attrValueAlias = JsonConvert.SerializeObject(values); } else {