添加市场价返回
parent
85139da31d
commit
16b4398af9
|
|
@ -23,6 +23,7 @@ class ProduckSkuResource extends JsonResource
|
||||||
'images' => $this->images,
|
'images' => $this->images,
|
||||||
'sell_price' => (string) $this->sell_price_format,
|
'sell_price' => (string) $this->sell_price_format,
|
||||||
'vip_price' => (string) $this->vip_price_format,
|
'vip_price' => (string) $this->vip_price_format,
|
||||||
|
'market_price' => (string) $this->market_price_format,
|
||||||
'sales' => $this->sales,
|
'sales' => $this->sales,
|
||||||
'description' => (string) $this->description,
|
'description' => (string) $this->description,
|
||||||
'attrs' => $this->attrs,
|
'attrs' => $this->attrs,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class ProductSkuTinyResource extends JsonResource
|
||||||
'cover' => (string) $this->cover,
|
'cover' => (string) $this->cover,
|
||||||
'sell_price' => (string) $this->sell_price_format,
|
'sell_price' => (string) $this->sell_price_format,
|
||||||
'vip_price' => (string) $this->vip_price_format,
|
'vip_price' => (string) $this->vip_price_format,
|
||||||
|
'market_price' => (string) $this->market_price_format,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,4 +181,18 @@ class ProductSku extends Model
|
||||||
|
|
||||||
return bcdiv($price, 100, 2);
|
return bcdiv($price, 100, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品市场价
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMarketPriceFormatAttribute()
|
||||||
|
{
|
||||||
|
if (is_null($price = $this->attributes['market_price'])) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return bcdiv($price, 100, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue