Authored by hf

code review by hf: do modify cart list add cartType parameter

... ... @@ -567,41 +567,41 @@ class Helpers
{
$arr = array();
$oneGoods = array();
foreach ($cartGoods as $key => $value) {
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods = array();
foreach ($cartGoods as $key => $value) {
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['isSelected'] = $value['selected'] === 'Y';
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['count'] = $value['buy_number'];
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['count'] = $value['buy_number'];
if ($isValid) {
$oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
}
// 上市期
if (!empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet']) ) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
$arr[$key] = $oneGoods;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
}
// 上市期
if (!empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet'])) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
$arr[$key] = $oneGoods;
}
return $arr;
}
... ... @@ -617,30 +617,30 @@ class Helpers
{
$arr = array();
$gift = array();
$oneGoods = array();
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionId'] = $value['promotion_id'];
$gift['promotionTitle'] = $value['promotion_title'];
foreach ($value['goods_list'] as $single) {
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = self::transPrice($single['last_price']);
$oneGoods['marketPrice'] = self::transPrice($single['market_price']);
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
}
$arr[] = $gift;
// 计算加价购商品数目
$count += $value['max_select_number'];
}
$gift = array();
$oneGoods = array();
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionId'] = $value['promotion_id'];
$gift['promotionTitle'] = $value['promotion_title'];
foreach ($value['goods_list'] as $single) {
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = self::transPrice($single['last_price']);
$oneGoods['marketPrice'] = self::transPrice($single['market_price']);
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
}
$arr[] = $gift;
// 计算加价购商品数目
$count += $value['max_select_number'];
}
return $arr;
}
... ...