Commit 84490a0b by mushishixian

修复判断问题

parent 5197a67a
Showing with 24 additions and 16 deletions
......@@ -257,26 +257,35 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
sortString := strconv.Itoa(sortNumber)
cnDiscountRatio = gjson.Get(discountRatio, "ration."+sortString).Float()
usDiscountRatio = gjson.Get(discountRatio, "ration_usd."+sortString).Float()
var hasSpecialCheck = false
//判断是否有符合的商品名称
goodsNames := gjson.Get(discountRatio, "goods_name").String()
goodsNameList := strings.Split(goodsNames, "€")
//找到有对应的商品名称,那么优先级肯定是最高的了
if php2go.InArray(sku.GoodsName, goodsNameList) {
break
goodsNames := gjson.Get(discountRatio, "goods_name."+sortString).String()
if goodsNames != "" {
hasSpecialCheck = true
goodsNameList := strings.Split(goodsNames, "€")
//找到有对应的商品名称,那么优先级肯定是最高的了
if php2go.InArray(sku.GoodsName, goodsNameList) {
break
}
}
//判断是否有符合的品牌名称
brandIds := gjson.Get(discountRatio, "brand").String()
standardBrandIdList := strings.Split(brandIds, "€")
standardBrandId := strconv.Itoa(sku.StandardBrand.StandardBrandId)
//找到有对应的品牌,那么优先级肯定是最高的了
if php2go.InArray(standardBrandId, standardBrandIdList) {
break
brandIds := gjson.Get(discountRatio, "brand."+sortString).String()
if brandIds != "" {
hasSpecialCheck = true
standardBrandIdList := strings.Split(brandIds, "€")
standardBrandId := strconv.Itoa(sku.StandardBrand.StandardBrandId)
//找到有对应的品牌,那么优先级肯定是最高的了
if php2go.InArray(standardBrandId, standardBrandIdList) {
break
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if len(goodsNameList) == 0 && len(standardBrandIdList) == 0 {
break
if hasSpecialCheck {
continue
}
break
}
}
sku.DiscountRatio.Ratio = cnDiscountRatio
......@@ -402,9 +411,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if hasSpecialCheck {
continue
} else {
break
}
break
}
}
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