code review by hf: do modify cart list add cartType parameter
Showing
1 changed file
with
53 additions
and
53 deletions
@@ -567,41 +567,41 @@ class Helpers | @@ -567,41 +567,41 @@ class Helpers | ||
567 | { | 567 | { |
568 | $arr = array(); | 568 | $arr = array(); |
569 | 569 | ||
570 | - $oneGoods = array(); | ||
571 | - foreach ($cartGoods as $key => $value) { | ||
572 | - $oneGoods['id'] = $value['product_sku']; | ||
573 | - $oneGoods['skn'] = $value['product_skn']; | ||
574 | - $oneGoods['name'] = $value['product_name']; | ||
575 | - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; | ||
576 | - $oneGoods['color'] = $value['color_name']; | ||
577 | - $oneGoods['size'] = $value['size_name']; | 570 | + $oneGoods = array(); |
571 | + foreach ($cartGoods as $key => $value) { | ||
572 | + $oneGoods['id'] = $value['product_sku']; | ||
573 | + $oneGoods['skn'] = $value['product_skn']; | ||
574 | + $oneGoods['name'] = $value['product_name']; | ||
575 | + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; | ||
576 | + $oneGoods['color'] = $value['color_name']; | ||
577 | + $oneGoods['size'] = $value['size_name']; | ||
578 | $oneGoods['isSelected'] = $value['selected'] === 'Y'; | 578 | $oneGoods['isSelected'] = $value['selected'] === 'Y'; |
579 | - $oneGoods['price'] = self::transPrice($value['sales_price']); | ||
580 | - $oneGoods['count'] = $value['buy_number']; | 579 | + $oneGoods['price'] = self::transPrice($value['sales_price']); |
580 | + $oneGoods['count'] = $value['buy_number']; | ||
581 | 581 | ||
582 | if ($isValid) { | 582 | if ($isValid) { |
583 | $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); | 583 | $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); |
584 | } | 584 | } |
585 | 585 | ||
586 | - //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; | ||
587 | - if (!isset($value['goods_type'])) { | ||
588 | - $oneGoods['isSoldOut'] = true; | ||
589 | - } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) { | ||
590 | - $oneGoods['isGift'] = true; | ||
591 | - } elseif ($value['goods_type'] == 'price_gift') { | ||
592 | - $oneGoods['isAdvanceBuy'] = true; | ||
593 | - } | ||
594 | - // 上市期 | ||
595 | - if (!empty($value['expect_arrival_time'])) { | ||
596 | - $oneGoods['appearDate'] = $value['expect_arrival_time']; | ||
597 | - } | ||
598 | - // 商品链接 | ||
599 | - if (isset($value['cn_alphabet']) ) { | ||
600 | - $oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html'); | ||
601 | - } | ||
602 | - | ||
603 | - $arr[$key] = $oneGoods; | ||
604 | - } | 586 | + //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; |
587 | + if (!isset($value['goods_type'])) { | ||
588 | + $oneGoods['isSoldOut'] = true; | ||
589 | + } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) { | ||
590 | + $oneGoods['isGift'] = true; | ||
591 | + } elseif ($value['goods_type'] == 'price_gift') { | ||
592 | + $oneGoods['isAdvanceBuy'] = true; | ||
593 | + } | ||
594 | + // 上市期 | ||
595 | + if (!empty($value['expect_arrival_time'])) { | ||
596 | + $oneGoods['appearDate'] = $value['expect_arrival_time']; | ||
597 | + } | ||
598 | + // 商品链接 | ||
599 | + if (isset($value['cn_alphabet'])) { | ||
600 | + $oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html'); | ||
601 | + } | ||
602 | + | ||
603 | + $arr[$key] = $oneGoods; | ||
604 | + } | ||
605 | 605 | ||
606 | return $arr; | 606 | return $arr; |
607 | } | 607 | } |
@@ -617,30 +617,30 @@ class Helpers | @@ -617,30 +617,30 @@ class Helpers | ||
617 | { | 617 | { |
618 | $arr = array(); | 618 | $arr = array(); |
619 | 619 | ||
620 | - $gift = array(); | ||
621 | - $oneGoods = array(); | ||
622 | - foreach ($advanceGoods as $value) { | ||
623 | - $gift = array(); | ||
624 | - $gift['promotionId'] = $value['promotion_id']; | ||
625 | - $gift['promotionTitle'] = $value['promotion_title']; | ||
626 | - | ||
627 | - foreach ($value['goods_list'] as $single) { | ||
628 | - $oneGoods['id'] = $single['product_skn']; | ||
629 | - $oneGoods['name'] = $single['product_name']; | ||
630 | - $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']); | ||
633 | - $oneGoods['marketPrice'] = self::transPrice($single['market_price']); | ||
634 | - $oneGoods['count'] = $single['storage_number']; | ||
635 | - | ||
636 | - $gift['goods'][] = $oneGoods; | ||
637 | - } | ||
638 | - | ||
639 | - $arr[] = $gift; | ||
640 | - | ||
641 | - // 计算加价购商品数目 | ||
642 | - $count += $value['max_select_number']; | ||
643 | - } | 620 | + $gift = array(); |
621 | + $oneGoods = array(); | ||
622 | + foreach ($advanceGoods as $value) { | ||
623 | + $gift = array(); | ||
624 | + $gift['promotionId'] = $value['promotion_id']; | ||
625 | + $gift['promotionTitle'] = $value['promotion_title']; | ||
626 | + | ||
627 | + foreach ($value['goods_list'] as $single) { | ||
628 | + $oneGoods['id'] = $single['product_skn']; | ||
629 | + $oneGoods['name'] = $single['product_name']; | ||
630 | + $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']); | ||
633 | + $oneGoods['marketPrice'] = self::transPrice($single['market_price']); | ||
634 | + $oneGoods['count'] = $single['storage_number']; | ||
635 | + | ||
636 | + $gift['goods'][] = $oneGoods; | ||
637 | + } | ||
638 | + | ||
639 | + $arr[] = $gift; | ||
640 | + | ||
641 | + // 计算加价购商品数目 | ||
642 | + $count += $value['max_select_number']; | ||
643 | + } | ||
644 | 644 | ||
645 | return $arr; | 645 | return $arr; |
646 | } | 646 | } |
-
Please register or login to post a comment