From 6f266fdf2304e330d6b768108a647f84339eafd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 6 May 2020 17:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=BB=93=E7=AE=97=E4=BB=B7?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 04198673b..4ea002d8c 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -738,6 +738,26 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, } }() for _, value := range order.Skus { + storeID := 0 + if order.StoreID == 0 { + storeID = order.JxStoreID + } else { + storeID = order.StoreID + } + result, _ := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, 0, []int{storeID}, []int{value.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt) + if len(result) > 0 { + if result[0].EarningPrice != 0 { + sku := value + sku.Count = value.Count - 1 + value.Count = 1 + if value.ShopPrice < value.SalePrice { + sku.EarningPrice = value.ShopPrice + } else { + sku.EarningPrice = value.SalePrice + } + order.Skus = append(order.Skus, sku) + } + } if _, err = dao.UpdateEntity(db, value, "EarningPrice", "StoreSubID"); err != nil { return nil, err }