From f6c7275d4f33d4bd1f560754ae68bf4525c9d3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 14 May 2020 09:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=93=E7=AE=97=E4=BB=B7?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- business/jxutils/jxutils_act.go | 6 ++++++ business/model/order.go | 1 + business/partner/purchase/mtwm/order.go | 7 +++++++ business/partner/purchase/yb/store_sku.go | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 200ececb5..88e899361 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -387,7 +387,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. storeID = order.StoreID } result, err := dao.GetEffectiveActStoreSkuInfo2(db, 0, []int{order.VendorID}, []int{model.ActSkuSecKill, model.ActSkuDirectDown}, []int{storeID}, []int{v.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt) - if len(result) > 0 && err == nil { + if (len(result) > 0 && err == nil) || v.IsVendorAct == model.YES { if v.VendorPrice == v.SalePrice { var earningPrice = 0 if v.ShopPrice < v.SalePrice { diff --git a/business/jxutils/jxutils_act.go b/business/jxutils/jxutils_act.go index 575e8f650..cd12c9076 100644 --- a/business/jxutils/jxutils_act.go +++ b/business/jxutils/jxutils_act.go @@ -1,6 +1,10 @@ package jxutils import ( + "fmt" + + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/model" ) @@ -19,9 +23,11 @@ func NewActStoreSkuMap(actStoreSkuList []*model.ActStoreSku2, isActPrice bool) ( } if (isActPrice && v.ActualActPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].ActualActPrice > v.ActualActPrice)) || (!isActPrice && v.EarningPrice > 0 && (actStoreSkuMap[index][v.VendorID] == nil || actStoreSkuMap[index][v.VendorID].EarningPrice > v.EarningPrice)) { + fmt.Println("test222222222222222222222222222222222", *v) actStoreSkuMap[index][v.VendorID] = v } } + fmt.Println("test11111111111111111111111111111111", utils.Format4Output(actStoreSkuMap, false)) actMap.actStoreSkuMap = actStoreSkuMap return actMap } diff --git a/business/model/order.go b/business/model/order.go index 175171a9f..a1a3cd677 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -154,6 +154,7 @@ type OrderSku struct { SkuType int `json:"skuType"` // 当前如果为gift就为1,否则缺省为0 PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换 OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑 + IsVendorAct int `json:"isVendorAct"` } // 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 7a53cfb1c..06e8fff29 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -232,6 +232,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo } ignoreSkuMap := make(map[int]int) // detail := result["detail"].([]interface{}) + multiSkuMap := make(map[int]int) for _, product := range detail { // product := product2.(map[string]interface{}) skuName := product["food_name"].(string) @@ -264,6 +265,12 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo // sku.SkuType = 1 // } order.Skus = append(order.Skus, sku) + multiSkuMap[sku.SkuID]++ + } + for _, v := range order.Skus { + if multiSkuMap[v.SkuID] > 1 && v.SalePrice == v.VendorPrice { + v.IsVendorAct = model.YES + } } jxutils.RefreshOrderSkuRelated(order) diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 85b208608..530c8964d 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -101,6 +101,9 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas if len(storeSkuList) == 1 { storeSku := storeSkuList[0] result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID) + if err != nil || result == nil { + return nil, err + } resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode) // resultp, err := getProductImages(vendorStoreID, storeSku.VendorSkuID) if err != nil {