From cdfede89eec314c8e8f99080eb507a27fa62ae89 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 26 May 2023 17:02:37 +0800 Subject: [PATCH] =?UTF-8?q?getSvipPriceAttr=20=E9=9D=9E=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/store/product/ProductAttrValue.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/common/model/store/product/ProductAttrValue.php b/app/common/model/store/product/ProductAttrValue.php index 013c2f81..db0ab438 100644 --- a/app/common/model/store/product/ProductAttrValue.php +++ b/app/common/model/store/product/ProductAttrValue.php @@ -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'); }