Authored by Rock Zhang

修改加价购商品详情返回的数据格式“

... ... @@ -63,7 +63,6 @@ class CartModel
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid, $shoppingKey);
print_r($cartData);
// 处理普通购物车和预售购物车的数据
do {
... ... @@ -657,6 +656,7 @@ class CartModel
$oneColor = array();
$sizes = array();
$oneSize = array();
$sizeList = array();
$thumbImageList = array();
$colorNum = 0;
$totalStorageNum = 0; // 总库存数
... ... @@ -678,14 +678,16 @@ class CartModel
$colorNum += $one['storage_number'];
$sizeStorageStr .= $one['storage_number'] . '/';
$sizes[] = $oneSize;
$sizeList[$val['color_id']][] = $oneSize;
$colorStorageGroup[$one['size_name']][$val['color_name']] = $one['storage_number'];
}
// 统计尺码对应的各个颜色的库存量
foreach ($sizes as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
foreach ($sizes as $colorId => $sizeArr) {
foreach ($sizeArr as $key => $value) {
$sizeList[$colorId][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
}
// 颜色
... ... @@ -709,6 +711,11 @@ class CartModel
$totalStorageNum += $colorNum;
}
// 格式化尺码对应的各个颜色分组
foreach ($colors as $color) {
$sizes[]['size'] = $sizeList[$color['id']];
}
$data['thumbs'] = $thumbImageList;
$data['colors'] = $colors;
$data['sizes'] = $sizes;
... ...