getSvipPriceAttr 非空判断

This commit is contained in:
mkm 2023-05-26 17:02:37 +08:00
parent 0f827e0108
commit cdfede89ee

View File

@ -53,16 +53,17 @@ class ProductAttrValue extends BaseModel
public function getSvipPriceAttr()
{
try {
if ($this->product->product_type == 0 && $this->product->show_svip_price && $this->product->svip_price_type == 1) {
$rate = merchantConfig($this->product->mer_id,'svip_store_rate');
$svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0;
return bcmul($this->price, $svip_store_rate,2);
if ($this->product){
try {
if ($this->product->product_type == 0 && $this->product->show_svip_price && $this->product->svip_price_type == 1) {
$rate = merchantConfig($this->product->mer_id,'svip_store_rate');
$svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0;
return bcmul($this->price, $svip_store_rate,2);
}
}catch (\Exception $e){
Log::error([$e->getMessage(),$e->getLine(),$e->getFile()]);
}
}catch (\Exception $e){
Log::error([$e->getMessage(),$e->getLine(),$e->getFile()]);
}
return $this->getData('svip_price');
}