Commit 3dd9fa38 by mushishixian

Merge branch 'ysx-魔方改版-20230313' into dev

parents fa8c99cd 84490a0b
Showing with 15 additions and 7 deletions
...@@ -257,26 +257,35 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -257,26 +257,35 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
sortString := strconv.Itoa(sortNumber) sortString := strconv.Itoa(sortNumber)
cnDiscountRatio = gjson.Get(discountRatio, "ration."+sortString).Float() cnDiscountRatio = gjson.Get(discountRatio, "ration."+sortString).Float()
usDiscountRatio = gjson.Get(discountRatio, "ration_usd."+sortString).Float() usDiscountRatio = gjson.Get(discountRatio, "ration_usd."+sortString).Float()
var hasSpecialCheck = false
//判断是否有符合的商品名称 //判断是否有符合的商品名称
goodsNames := gjson.Get(discountRatio, "goods_name").String() goodsNames := gjson.Get(discountRatio, "goods_name."+sortString).String()
if goodsNames != "" {
hasSpecialCheck = true
goodsNameList := strings.Split(goodsNames, "€") goodsNameList := strings.Split(goodsNames, "€")
//找到有对应的商品名称,那么优先级肯定是最高的了 //找到有对应的商品名称,那么优先级肯定是最高的了
if php2go.InArray(sku.GoodsName, goodsNameList) { if php2go.InArray(sku.GoodsName, goodsNameList) {
break break
} }
}
//判断是否有符合的品牌名称 //判断是否有符合的品牌名称
brandIds := gjson.Get(discountRatio, "brand").String() brandIds := gjson.Get(discountRatio, "brand."+sortString).String()
if brandIds != "" {
hasSpecialCheck = true
standardBrandIdList := strings.Split(brandIds, "€") standardBrandIdList := strings.Split(brandIds, "€")
standardBrandId := strconv.Itoa(sku.StandardBrand.StandardBrandId) standardBrandId := strconv.Itoa(sku.StandardBrand.StandardBrandId)
//找到有对应的品牌,那么优先级肯定是最高的了 //找到有对应的品牌,那么优先级肯定是最高的了
if php2go.InArray(standardBrandId, standardBrandIdList) { if php2go.InArray(standardBrandId, standardBrandIdList) {
break break
} }
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if len(goodsNameList) == 0 && len(standardBrandIdList) == 0 {
break
} }
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if hasSpecialCheck {
continue
}
break
} }
} }
sku.DiscountRatio.Ratio = cnDiscountRatio sku.DiscountRatio.Ratio = cnDiscountRatio
...@@ -402,9 +411,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -402,9 +411,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了 //如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if hasSpecialCheck { if hasSpecialCheck {
continue continue
} else {
break
} }
break
} }
} }
sku.PriceRatio = priceRatioList sku.PriceRatio = priceRatioList
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment