根据平台反算重量问题修改

This commit is contained in:
苏尹岚
2020-03-18 17:21:21 +08:00
parent 239a44afdc
commit 818cf48d5d

View File

@@ -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,