From 818cf48d5dbfe3be702f8f1a6da0eb6b008b3a0f 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, 18 Mar 2020 17:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=B9=B3=E5=8F=B0=E5=8F=8D?= =?UTF-8?q?=E7=AE=97=E9=87=8D=E9=87=8F=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 38030778b..83a26b283 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3611,6 +3611,8 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, pricePercentagePack []*model.PricePercentageItem cats []*model.ThingMap skus []*model.SkuAndName + vendorPrice int + specQuality float64 ) sql := ` SELECT t1.* @@ -3637,7 +3639,20 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, return result, fmt.Errorf("没有找到该京东门店对应的京西门店!,京东门店ID :[%v]", v.JdStoreID) } err = jxutils.Strings2Objs(store.PricePercentagePackStr, &pricePercentagePack) - jxPrice := jxutils.CaculateJxPriceByPricePack(pricePercentagePack, 0, v.Price) + if skus[0].Unit == model.SpecialUnit { + if skus[0].SpecUnit == model.SpecUnitNames[1] || skus[0].SpecUnit == model.SpecUnitNames[2] { + specQuality = float64(skus[0].SpecQuality) * 1000 + } else { + specQuality = float64(skus[0].SpecQuality) + } + vendorPrice = int(utils.Float64TwoInt64(specQuality / utils.Int2Float64(model.SpecialSpecQuality) * utils.Int2Float64(v.Price))) + } else { + vendorPrice = v.Price + } + jxPrice := jxutils.CaculateJxPriceByPricePack(pricePercentagePack, 0, vendorPrice) + if skus[0].Unit == model.SpecialUnit { + jxPrice = jxPrice * int(utils.Float64TwoInt64(utils.Int2Float64(model.SpecialSpecQuality)/specQuality)) + } jdMap[store.ID] = append(jdMap[store.ID], &JdStoreSkus{ JdSkuID: skus[0].NameID, Price: jxPrice, @@ -3684,6 +3699,8 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, for _, v := range jdStoreSkus { var ( pricePercentagePack []*model.PricePercentageItem + vendorPrice int + specQuality float64 ) skus, _ := dao.GetSkus(db, []int{v.JdSkuID}, nil, nil, nil, nil) if len(skus) == 0 { @@ -3691,7 +3708,20 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, } store, _ := dao.GetStoreDetail(db, v.JdStoreID, vendorID) err = jxutils.Strings2Objs(store.PricePercentagePackStr, &pricePercentagePack) - jxPrice := jxutils.CaculateJxPriceByPricePack(pricePercentagePack, 0, v.Price) + if skus[0].Unit == model.SpecialUnit { + if skus[0].SpecUnit == model.SpecUnitNames[1] || skus[0].SpecUnit == model.SpecUnitNames[2] { + specQuality = float64(skus[0].SpecQuality) * 1000 + } else { + specQuality = float64(skus[0].SpecQuality) + } + vendorPrice = int(utils.Float64TwoInt64(specQuality / utils.Int2Float64(model.SpecialSpecQuality) * utils.Int2Float64(v.Price))) + } else { + vendorPrice = v.Price + } + jxPrice := jxutils.CaculateJxPriceByPricePack(pricePercentagePack, 0, vendorPrice) + if skus[0].Unit == model.SpecialUnit { + jxPrice = jxPrice * int(utils.Float64TwoInt64(utils.Int2Float64(model.SpecialSpecQuality)/specQuality)) + } jdMap[v.JdStoreID] = append(jdMap[v.JdStoreID], &JdStoreSkus{ JdSkuID: skus[0].NameID, Price: jxPrice,