From a574d77efca8ad3f49a9b3b671272c019af2997f Mon Sep 17 00:00:00 2001 From: sanji Date: Tue, 14 Nov 2023 13:56:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E5=8D=95=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Server.Business/Order/OrderBusiness.cs | 38 ++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index a01dbbb8..fc88b261 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -1293,26 +1293,32 @@ namespace BBWY.Server.Business var itemList = new List(); var couponDetailVoJToken = jtoken["jingdong_pop_order_coupondetail_responce"]["couponDetailExternal"]["couponDetailVo"]; var promotionTaskJArray = couponDetailVoJToken["promotionList"] as JArray; - itemList.AddRange(promotionTaskJArray.Select(j => new OrderCouponDetailGroupItemResponse() + if (promotionTaskJArray != null) { - Initiator = string.IsNullOrEmpty(j.Value("promotionName")) ? "平台" : "商家", - CouponOrPromotionType = j.Value("saleTypeDesc"), - PreferentialAmount = j.Value("salePrice"), - UndertakenByMerchantAmount = j.Value("salePrice"), - UndertakenByPlatformAmount = 0 - })); + itemList.AddRange(promotionTaskJArray.Select(j => new OrderCouponDetailGroupItemResponse() + { + Initiator = string.IsNullOrEmpty(j.Value("promotionName")) ? "平台" : "商家", + CouponOrPromotionType = j.Value("saleTypeDesc"), + PreferentialAmount = j.Value("salePrice"), + UndertakenByMerchantAmount = j.Value("salePrice"), + UndertakenByPlatformAmount = 0 + })); + } var couponJArray = couponDetailVoJToken["couponList"] as JArray; - itemList.AddRange(couponJArray.Select(j => new OrderCouponDetailGroupItemResponse() + if (couponJArray != null) { - Initiator = string.IsNullOrEmpty(j.Value("couponName")) ? "平台" : "商家", - CouponOrPromotionType = j.Value("couponTypeDesc"), - PreferentialAmount = j.Value("couponPrice"), - UndertakenByMerchantAmount = j.Value("priceDivide") == true ? - j.Value("venderDivideMoney") : - j.Value("couponPrice"), - UndertakenByPlatformAmount = j.Value("jdDivideMoney") - })); + itemList.AddRange(couponJArray.Select(j => new OrderCouponDetailGroupItemResponse() + { + Initiator = string.IsNullOrEmpty(j.Value("couponName")) ? "平台" : "商家", + CouponOrPromotionType = j.Value("couponTypeDesc"), + PreferentialAmount = j.Value("couponPrice"), + UndertakenByMerchantAmount = j.Value("priceDivide") == true ? + j.Value("venderDivideMoney") : + j.Value("couponPrice"), + UndertakenByPlatformAmount = j.Value("jdDivideMoney") + })); + } var groups = itemList.GroupBy(x => x.Initiator);