修改商品采购价格设置的错误
This commit is contained in:
parent
aee0609d17
commit
733adc5091
@ -431,14 +431,30 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
public static function getProductCatePriceRate($product)
|
public static function getProductCatePriceRate($product)
|
||||||
{
|
{
|
||||||
$productCatePriceRate = StoreCategory::where('id', $product['cate_id'])->value('price_rate');
|
$productCatePriceRate = StoreCategory::where('id', $product['cate_id'])->value('price_rate');
|
||||||
if (!empty($productCatePriceRate)) {
|
if (!empty($productCatePriceRate) && self::hasPurchase($productCatePriceRate)) {
|
||||||
return $productCatePriceRate;
|
return $productCatePriceRate;
|
||||||
}
|
}
|
||||||
$productCatePriceRate = StoreCategory::where('id', $product['two_cate_id'])->value('price_rate');
|
$productCatePriceRate = StoreCategory::where('id', $product['two_cate_id'])->value('price_rate');
|
||||||
if (!empty($productCatePriceRate)) {
|
if (!empty($productCatePriceRate) && self::hasPurchase($productCatePriceRate)) {
|
||||||
return $productCatePriceRate;
|
return $productCatePriceRate;
|
||||||
}
|
}
|
||||||
return StoreCategory::where('id', $product['top_cate_id'])->value('price_rate');
|
$productCatePriceRate = StoreCategory::where('id', $product['top_cate_id'])->value('price_rate');
|
||||||
|
if (!empty($productCatePriceRate) && self::hasPurchase($productCatePriceRate)) {
|
||||||
|
return $productCatePriceRate;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function hasPurchase(array $productCatePriceRate): bool
|
||||||
|
{
|
||||||
|
$res = true;
|
||||||
|
foreach ($productCatePriceRate as $item) {
|
||||||
|
if ($item['id'] == 21 && empty($item['rate'])) {
|
||||||
|
$res = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user