6
0
Fork 0

添加市场价返回

release
vine_liutk 2022-01-18 11:23:25 +08:00 committed by 李静
parent 85139da31d
commit 16b4398af9
3 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,7 @@ class ProduckSkuResource extends JsonResource
'images' => $this->images,
'sell_price' => (string) $this->sell_price_format,
'vip_price' => (string) $this->vip_price_format,
'market_price' => (string) $this->market_price_format,
'sales' => $this->sales,
'description' => (string) $this->description,
'attrs' => $this->attrs,

View File

@ -20,6 +20,7 @@ class ProductSkuTinyResource extends JsonResource
'cover' => (string) $this->cover,
'sell_price' => (string) $this->sell_price_format,
'vip_price' => (string) $this->vip_price_format,
'market_price' => (string) $this->market_price_format,
];
}
}

View File

@ -181,4 +181,18 @@ class ProductSku extends Model
return bcdiv($price, 100, 2);
}
/**
* 获取商品市场价
*
* @return string
*/
public function getMarketPriceFormatAttribute()
{
if (is_null($price = $this->attributes['market_price'])) {
return '';
}
return bcdiv($price, 100, 2);
}
}