|
@@ -178,9 +178,10 @@ class Helpers |
|
@@ -178,9 +178,10 @@ class Helpers |
178
|
* @param int $width 图片的宽度
|
178
|
* @param int $width 图片的宽度
|
179
|
* @param int $height 图片的高度
|
179
|
* @param int $height 图片的高度
|
180
|
* @param bool $isApp 判断是不是APP访问
|
180
|
* @param bool $isApp 判断是不是APP访问
|
|
|
181
|
+ * @param bool $showPoint 商品价格是否显示小数位,默认显示
|
181
|
* @return array | false
|
182
|
* @return array | false
|
182
|
*/
|
183
|
*/
|
183
|
- public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388, $isApp = false)
|
184
|
+ public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388, $isApp = false, $showPoint = true)
|
184
|
{
|
185
|
{
|
185
|
// 商品信息有问题,则不显示
|
186
|
// 商品信息有问题,则不显示
|
186
|
if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
|
187
|
if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
|
|
@@ -202,8 +203,12 @@ class Helpers |
|
@@ -202,8 +203,12 @@ class Helpers |
202
|
$result['product_id'] = $productData['product_id'];
|
203
|
$result['product_id'] = $productData['product_id'];
|
203
|
$result['thumb'] = Images::getImageUrl($productData['default_images'], $width, $height);
|
204
|
$result['thumb'] = Images::getImageUrl($productData['default_images'], $width, $height);
|
204
|
$result['name'] = $productData['product_name'];
|
205
|
$result['name'] = $productData['product_name'];
|
205
|
- $result['price'] = empty($productData['market_price']) ? false : $productData['market_price'] . '.00';
|
|
|
206
|
- $result['salePrice'] = $productData['sales_price'] . '.00';
|
206
|
+ $result['price'] = empty($productData['market_price']) ? false : $productData['market_price'];
|
|
|
207
|
+ $result['salePrice'] = $productData['sales_price'];
|
|
|
208
|
+ if ($showPoint) {
|
|
|
209
|
+ $result['price'] && $result['price'] .= '.00';
|
|
|
210
|
+ $result['salePrice'] && $result['salePrice'] .= '.00';
|
|
|
211
|
+ }
|
207
|
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
|
212
|
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
|
208
|
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
|
213
|
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
|
209
|
. $productData['goods_list'][0]['goods_id']
|
214
|
. $productData['goods_list'][0]['goods_id']
|