...
|
...
|
@@ -189,50 +189,7 @@ class CartModel |
|
|
$product = CartData::cartProductData($uid, $skn);
|
|
|
if (isset($product['code']) && $product['code'] === 200) {
|
|
|
$result['code'] = 200;
|
|
|
$data = array();
|
|
|
$productData = $product['data'];
|
|
|
|
|
|
// 品牌信息
|
|
|
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
|
|
|
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
|
|
|
}
|
|
|
|
|
|
$data['name'] = $productData['product_name'];
|
|
|
$data['price'] = $productData['market_price'];
|
|
|
$data['salePrice'] = $productData['sales_price'];
|
|
|
$data['storage'] = $productData['storage_sum'];
|
|
|
$data['num'] = $num;
|
|
|
|
|
|
// 商品选择
|
|
|
if (isset($productData['goods_list'])) {
|
|
|
$goodsList = $productData['goods_list'];
|
|
|
|
|
|
$colors = array();
|
|
|
$oneColor = array();
|
|
|
$sizes = array();
|
|
|
$oneSize = array();
|
|
|
foreach ($goodsList as $val) {
|
|
|
// 颜色
|
|
|
$oneColor = array();
|
|
|
$oneColor['id'] = $val['color_id'];
|
|
|
$oneColor['name'] = $val['color_name'];
|
|
|
|
|
|
// 尺码
|
|
|
foreach ($val['size_list'] as $one) {
|
|
|
$oneSize = array();
|
|
|
$oneSize['id'] = $one['size_id'];
|
|
|
$oneSize['name'] = $one['size_name'];
|
|
|
}
|
|
|
$sizes[] = $oneSize;
|
|
|
|
|
|
$oneColor['sizes'] = $sizes;
|
|
|
$colors[] = $oneColor;
|
|
|
}
|
|
|
|
|
|
$data['colors'] = $colors;
|
|
|
}
|
|
|
|
|
|
$result['data'] = $data;
|
|
|
$result['data'] = self::procGoodsDetail($product['data'], $num);
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -252,49 +209,7 @@ class CartModel |
|
|
$product = CartData::giftProductData($skn, $promotionId);
|
|
|
if (isset($product['code']) && $product['code'] === 200) {
|
|
|
$result['code'] = 200;
|
|
|
$data = array();
|
|
|
$productData = $product['data'];
|
|
|
|
|
|
// 品牌信息
|
|
|
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
|
|
|
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
|
|
|
}
|
|
|
|
|
|
$data['name'] = $productData['product_name'];
|
|
|
$data['price'] = $productData['market_price'];
|
|
|
$data['salePrice'] = $productData['sales_price'];
|
|
|
$data['storage'] = $productData['storage_sum'];
|
|
|
|
|
|
// 商品选择
|
|
|
if (isset($productData['goods_list'])) {
|
|
|
$goodsList = $productData['goods_list'];
|
|
|
|
|
|
$colors = array();
|
|
|
$oneColor = array();
|
|
|
$sizes = array();
|
|
|
$oneSize = array();
|
|
|
foreach ($goodsList as $val) {
|
|
|
// 颜色
|
|
|
$oneColor = array();
|
|
|
$oneColor['id'] = $val['color_id'];
|
|
|
$oneColor['name'] = $val['color_name'];
|
|
|
|
|
|
// 尺码
|
|
|
foreach ($val['size_list'] as $one) {
|
|
|
$oneSize = array();
|
|
|
$oneSize['id'] = $one['size_id'];
|
|
|
$oneSize['name'] = $one['size_name'];
|
|
|
}
|
|
|
$sizes[] = $oneSize;
|
|
|
|
|
|
$oneColor['sizes'] = $sizes;
|
|
|
$colors[] = $oneColor;
|
|
|
}
|
|
|
|
|
|
$data['colors'] = $colors;
|
|
|
}
|
|
|
|
|
|
$result['data'] = $data;
|
|
|
$result['data'] = self::procGoodsDetail($product['data']);
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -657,6 +572,62 @@ class CartModel |
|
|
|
|
|
|
|
|
/**
|
|
|
* 处理购物车商品、加价购商品、赠品详情数据
|
|
|
*
|
|
|
* @param array $productData 要处理的商品数据
|
|
|
* @param int $num 购买数目
|
|
|
* @return array $data 处理之后的数据
|
|
|
*/
|
|
|
private static function procGoodsDetail($productData, $num = null)
|
|
|
{
|
|
|
$data = array();
|
|
|
|
|
|
// 品牌信息
|
|
|
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
|
|
|
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
|
|
|
}
|
|
|
|
|
|
$data['name'] = $productData['product_name'];
|
|
|
$data['price'] = $productData['market_price'];
|
|
|
$data['salePrice'] = $productData['sales_price'];
|
|
|
$data['storage'] = $productData['storage_sum'];
|
|
|
if ($num !== null) {
|
|
|
$data['num'] = $num;
|
|
|
}
|
|
|
|
|
|
// 商品选择
|
|
|
if (isset($productData['goods_list'])) {
|
|
|
$goodsList = $productData['goods_list'];
|
|
|
|
|
|
$colors = array();
|
|
|
$oneColor = array();
|
|
|
$sizes = array();
|
|
|
$oneSize = array();
|
|
|
foreach ($goodsList as $val) {
|
|
|
// 颜色
|
|
|
$oneColor = array();
|
|
|
$oneColor['id'] = $val['color_id'];
|
|
|
$oneColor['name'] = $val['color_name'];
|
|
|
|
|
|
// 尺码
|
|
|
foreach ($val['size_list'] as $one) {
|
|
|
$oneSize = array();
|
|
|
$oneSize['id'] = $one['size_id'];
|
|
|
$oneSize['name'] = $one['size_name'];
|
|
|
}
|
|
|
$sizes[] = $oneSize;
|
|
|
|
|
|
$oneColor['sizes'] = $sizes;
|
|
|
$colors[] = $oneColor;
|
|
|
}
|
|
|
|
|
|
$data['colors'] = $colors;
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处理不同类型的购物车数据
|
|
|
*
|
|
|
* @param array $data 不同类型购物车数据
|
...
|
...
|
|