Authored by 毕凯

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -561,9 +561,10 @@ class Helpers @@ -561,9 +561,10 @@ class Helpers
561 * 561 *
562 * @param array $cartGoods 购物车商品列表 562 * @param array $cartGoods 购物车商品列表
563 * @param boolean $isValid 是否是可用商品(非失效商品),默认是 563 * @param boolean $isValid 是否是可用商品(非失效商品),默认是
  564 + * @param bool $isAdvanceCart 是否是预售购物车(和上市期有关)
564 * @return array 处理之后的购物车商品数据 565 * @return array 处理之后的购物车商品数据
565 */ 566 */
566 - public static function formatCartGoods($cartGoods, $isValid = true) 567 + public static function formatCartGoods($cartGoods, $isAdvanceCart, $isValid = true)
567 { 568 {
568 $arr = array(); 569 $arr = array();
569 570
@@ -592,7 +593,7 @@ class Helpers @@ -592,7 +593,7 @@ class Helpers
592 $oneGoods['isAdvanceBuy'] = true; 593 $oneGoods['isAdvanceBuy'] = true;
593 } 594 }
594 // 上市期 595 // 上市期
595 - if (!empty($value['expect_arrival_time'])) { 596 + if ($isAdvanceCart && !empty($value['expect_arrival_time'])) {
596 $oneGoods['appearDate'] = $value['expect_arrival_time']; 597 $oneGoods['appearDate'] = $value['expect_arrival_time'];
597 } 598 }
598 // 商品链接 599 // 商品链接
@@ -628,7 +629,6 @@ class Helpers @@ -628,7 +629,6 @@ class Helpers
628 $oneGoods['id'] = $single['product_skn']; 629 $oneGoods['id'] = $single['product_skn'];
629 $oneGoods['name'] = $single['product_name']; 630 $oneGoods['name'] = $single['product_name'];
630 $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : ''; 631 $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
631 - $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据  
632 $oneGoods['price'] = self::transPrice($single['last_price']); 632 $oneGoods['price'] = self::transPrice($single['last_price']);
633 $oneGoods['marketPrice'] = self::transPrice($single['market_price']); 633 $oneGoods['marketPrice'] = self::transPrice($single['market_price']);
634 $oneGoods['count'] = $single['storage_number']; 634 $oneGoods['count'] = $single['storage_number'];
@@ -103,7 +103,7 @@ class CartModel @@ -103,7 +103,7 @@ class CartModel
103 103
104 /* 普通购物车 */ 104 /* 普通购物车 */
105 $result['commonGoodsCount'] = $ordinaryCount; 105 $result['commonGoodsCount'] = $ordinaryCount;
106 - $result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy); 106 + $result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy, false);
107 /* 预售购物车 */ 107 /* 预售购物车 */
108 $result['presellGoodsCount'] = $advanceCount; 108 $result['presellGoodsCount'] = $advanceCount;
109 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy); 109 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
@@ -722,15 +722,16 @@ class CartModel @@ -722,15 +722,16 @@ class CartModel
722 * @param array $data 不同类型购物车数据 722 * @param array $data 不同类型购物车数据
723 * @param bool $onlyGift 只获取赠品的商品数据 723 * @param bool $onlyGift 只获取赠品的商品数据
724 * @param bool $onlyAdvanceBuy 只获取加价购的商品数据 724 * @param bool $onlyAdvanceBuy 只获取加价购的商品数据
  725 + * @param bool $isAdvanceCart 是否是预售购物车,默认是,(和上市期有关)
725 * @return array $result 处理之后的不同类型购物车数据 726 * @return array $result 处理之后的不同类型购物车数据
726 */ 727 */
727 - private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false) 728 + private static function procCartData($data, $onlyGift = false, $onlyAdvanceBuy = false, $isAdvanceCart = true)
728 { 729 {
729 $result = array(); 730 $result = array();
730 731
731 do { 732 do {
732 // 数据为空时返回空的标志 733 // 数据为空时返回空的标志
733 - if (empty($data)) { 734 + if (empty($data['goods_list'])) {
734 break; 735 break;
735 } 736 }
736 737
@@ -746,13 +747,13 @@ class CartModel @@ -746,13 +747,13 @@ class CartModel
746 } 747 }
747 748
748 // 购买的可用商品列表 749 // 购买的可用商品列表
749 - $validGoods = Helpers::formatCartGoods($data['goods_list']); 750 + $validGoods = Helpers::formatCartGoods($data['goods_list'], $isAdvanceCart);
750 if (!empty($validGoods)) { 751 if (!empty($validGoods)) {
751 $result['goods'] = $validGoods; 752 $result['goods'] = $validGoods;
752 } 753 }
753 754
754 // 失效商品列表 755 // 失效商品列表
755 - $notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list'], false); 756 + $notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list'], $isAdvanceCart, false);
756 if (!empty($notValidGoods)) { 757 if (!empty($notValidGoods)) {
757 $result['notValidGoods'] = $notValidGoods; 758 $result['notValidGoods'] = $notValidGoods;
758 } 759 }