Authored by Rock Zhang

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

@@ -63,7 +63,6 @@ class CartModel @@ -63,7 +63,6 @@ class CartModel
63 63
64 // 调用接口获取购物车的数据 64 // 调用接口获取购物车的数据
65 $cartData = CartData::cartData($uid, $shoppingKey); 65 $cartData = CartData::cartData($uid, $shoppingKey);
66 - print_r($cartData);  
67 66
68 // 处理普通购物车和预售购物车的数据 67 // 处理普通购物车和预售购物车的数据
69 do { 68 do {
@@ -657,6 +656,7 @@ class CartModel @@ -657,6 +656,7 @@ class CartModel
657 $oneColor = array(); 656 $oneColor = array();
658 $sizes = array(); 657 $sizes = array();
659 $oneSize = array(); 658 $oneSize = array();
  659 + $sizeList = array();
660 $thumbImageList = array(); 660 $thumbImageList = array();
661 $colorNum = 0; 661 $colorNum = 0;
662 $totalStorageNum = 0; // 总库存数 662 $totalStorageNum = 0; // 总库存数
@@ -678,14 +678,16 @@ class CartModel @@ -678,14 +678,16 @@ class CartModel
678 $colorNum += $one['storage_number']; 678 $colorNum += $one['storage_number'];
679 $sizeStorageStr .= $one['storage_number'] . '/'; 679 $sizeStorageStr .= $one['storage_number'] . '/';
680 680
681 - $sizes[] = $oneSize; 681 + $sizeList[$val['color_id']][] = $oneSize;
682 682
683 $colorStorageGroup[$one['size_name']][$val['color_name']] = $one['storage_number']; 683 $colorStorageGroup[$one['size_name']][$val['color_name']] = $one['storage_number'];
684 } 684 }
685 685
686 // 统计尺码对应的各个颜色的库存量 686 // 统计尺码对应的各个颜色的库存量
687 - foreach ($sizes as &$sizeArr) {  
688 - $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) ); 687 + foreach ($sizes as $colorId => $sizeArr) {
  688 + foreach ($sizeArr as $key => $value) {
  689 + $sizeList[$colorId][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
  690 + }
689 } 691 }
690 692
691 // 颜色 693 // 颜色
@@ -709,6 +711,11 @@ class CartModel @@ -709,6 +711,11 @@ class CartModel
709 $totalStorageNum += $colorNum; 711 $totalStorageNum += $colorNum;
710 } 712 }
711 713
  714 + // 格式化尺码对应的各个颜色分组
  715 + foreach ($colors as $color) {
  716 + $sizes[]['size'] = $sizeList[$color['id']];
  717 + }
  718 +
712 $data['thumbs'] = $thumbImageList; 719 $data['thumbs'] = $thumbImageList;
713 $data['colors'] = $colors; 720 $data['colors'] = $colors;
714 $data['sizes'] = $sizes; 721 $data['sizes'] = $sizes;