...
|
...
|
@@ -197,7 +197,7 @@ class Helpers |
|
|
* 格式化商品信息
|
|
|
*
|
|
|
* @param array $productData 需要格式化的商品数据
|
|
|
* @param bool $showTag 控制是否显示标签
|
|
|
* @param bool $showTags 控制是否显示标签
|
|
|
* @param bool $showNew 控制是否显示NEW图标
|
|
|
* @param bool $showSale 控制是否显示SALE图标
|
|
|
* @param int $width 图片的宽度
|
...
|
...
|
@@ -522,6 +522,7 @@ class Helpers |
|
|
* @param array $orderGoods 订单
|
|
|
* @param int $count 计订单件数
|
|
|
* @param bool $haveLink 控制是否需要商品链接
|
|
|
* @return array $arr 处理之后的订单商品数据
|
|
|
*/
|
|
|
public static function formatOrderGoods($orderGoods, &$count = 0, $haveLink = false)
|
|
|
{
|
...
|
...
|
@@ -559,9 +560,9 @@ class Helpers |
|
|
* 格式化购物车商品
|
|
|
*
|
|
|
* @param array $cartGoods 购物车商品列表
|
|
|
* @param bool $haveLink 控制是否需要商品链接
|
|
|
* @return array 处理之后的购物车商品数据
|
|
|
*/
|
|
|
public static function formatCartGoods($cartGoods, $haveLink = false)
|
|
|
public static function formatCartGoods($cartGoods)
|
|
|
{
|
|
|
$arr = array();
|
|
|
|
...
|
...
|
@@ -573,25 +574,24 @@ class Helpers |
|
|
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : '';
|
|
|
$oneGoods['color'] = $value['color_name'];
|
|
|
$oneGoods['size'] = $value['size_name'];
|
|
|
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
|
|
|
$oneGoods['price'] = $value['real_price'];
|
|
|
$oneGoods['price'] = self::transPrice($value['sales_price']);
|
|
|
$oneGoods['count'] = $value['buy_number'];
|
|
|
$oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']);
|
|
|
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
|
|
|
if (!isset($value['goods_type'])) {
|
|
|
$oneGoods['soldOut'] = true;
|
|
|
} elseif ($value['goods_type'] == 'gift') {
|
|
|
$oneGoods['gift'] = true;
|
|
|
$oneGoods['isSoldOut'] = true;
|
|
|
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
|
|
|
$oneGoods['isGift'] = true;
|
|
|
} elseif ($value['goods_type'] == 'price_gift') {
|
|
|
$oneGoods['advanceBuy'] = true;
|
|
|
$oneGoods['isAdvanceBuy'] = true;
|
|
|
}
|
|
|
// 上市期
|
|
|
if (!empty($value['expect_arrival_time'])) {
|
|
|
$oneGoods['appearDate'] = $value['expect_arrival_time'];
|
|
|
}
|
|
|
// 商品链接
|
|
|
if ($haveLink && isset($value['product_id'])) {
|
|
|
$oneGoods['link'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
|
|
|
if (isset($value['cn_alphabet']) ) {
|
|
|
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
|
|
|
}
|
|
|
|
|
|
$arr[$key] = $oneGoods;
|
...
|
...
|
@@ -604,13 +604,13 @@ class Helpers |
|
|
* 格式化加价购商品
|
|
|
*
|
|
|
* @param array $advanceGoods 加价购商品列表
|
|
|
* @param bool $haveLink 控制是否需要商品链接
|
|
|
* @param int $count 计商品件数
|
|
|
* @return array $arr 处理之后的加价购商品数据
|
|
|
*/
|
|
|
public static function formatAdvanceGoods($advanceGoods)
|
|
|
public static function formatAdvanceGoods($advanceGoods, &$count = 0)
|
|
|
{
|
|
|
$arr = array();
|
|
|
|
|
|
|
|
|
$gift = array();
|
|
|
$oneGoods = array();
|
|
|
foreach ($advanceGoods as $value) {
|
...
|
...
|
@@ -630,6 +630,9 @@ class Helpers |
|
|
}
|
|
|
|
|
|
$arr[] = $gift;
|
|
|
|
|
|
// 计算加价购商品数目
|
|
|
$count += count($value['goods_list']);
|
|
|
}
|
|
|
|
|
|
return $arr;
|
...
|
...
|
|