Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/develop/wap' into beta/wap

@@ -899,9 +899,9 @@ class Helpers @@ -899,9 +899,9 @@ class Helpers
899 /** 899 /**
900 * 按照数组中指定字段排序二维数组 900 * 按照数组中指定字段排序二维数组
901 * 901 *
902 - * @param array &$array 需要排序的数组  
903 - * @param string $field 字段名称  
904 - * @param boolean $desc 时候降序排列,默认为false 902 + * @param array &$array 需要排序的数组
  903 + * @param string $field 字段名称
  904 + * @param boolean $desc 是否降序排列,默认为false
905 */ 905 */
906 public static function sortArrByField(&$array, $field, $desc = false) 906 public static function sortArrByField(&$array, $field, $desc = false)
907 { 907 {
@@ -4,6 +4,7 @@ namespace Product; @@ -4,6 +4,7 @@ namespace Product;
4 4
5 use LibModels\Wap\Product\DetailData; 5 use LibModels\Wap\Product\DetailData;
6 use Plugin\Helpers; 6 use Plugin\Helpers;
  7 +use Plugin\Images;
7 8
8 /** 9 /**
9 * 商品详情页模板相关的数据模型 10 * 商品详情页模板相关的数据模型
@@ -771,16 +772,26 @@ class DetailModel @@ -771,16 +772,26 @@ class DetailModel
771 // 发售日期 772 // 发售日期
772 $result['releaseDate'] = $product['saleTime'] . '发售'; 773 $result['releaseDate'] = $product['saleTime'] . '发售';
773 // baner 774 // baner
774 - $result['banner'] = $product['defaultUrl']; 775 + $result['banner'] = Helpers::getImageUrl($product['defaultUrl'], 750, '');
775 $result['description'] = $product['description']; 776 $result['description'] = $product['description'];
776 777
777 // 附件 778 // 附件
778 - if (isset($product['attachment'])) {  
779 - foreach ($product['attachment'] as $item) {  
780 - $result['attaches'][] = self::procLimitProductAttach($item); 779 + if (!isset($product['attachment'])) {
  780 + break;
  781 + }
  782 +
  783 + $result['attaches'] = array();
  784 + foreach ($product['attachment'] as $item) {
  785 + if ($item['isDefault'] === 1) { // 排除默认图片
  786 + continue;
781 } 787 }
  788 +
  789 + $result['attaches'][] = self::procLimitProductAttach($item);
782 } 790 }
783 791
  792 + if(count($result['attaches']) > 1) {
  793 + Helpers::sortArrByField($result['attaches'], 'orderBy', true);
  794 + }
784 } while (false); 795 } while (false);
785 796
786 return $result; 797 return $result;
@@ -799,33 +810,29 @@ class DetailModel @@ -799,33 +810,29 @@ class DetailModel
799 switch(intval($attachment['attachType'])) { 810 switch(intval($attachment['attachType'])) {
800 case 1: // 大图文字 811 case 1: // 大图文字
801 $result['img'] = array( 812 $result['img'] = array(
802 - 'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 290, 200), 813 + 'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
803 'attachName' => $attachment['attachName'], 814 'attachName' => $attachment['attachName'],
804 - 'intro' => $attachment['intro'],  
805 - 'orderBy' => $attachment['orderBy'] 815 + 'intro' => $attachment['intro']
806 ); 816 );
  817 + $result['orderBy'] = $attachment['orderBy'];
807 break; 818 break;
808 case 2: // 视频 819 case 2: // 视频
809 $result['video'] = array( 820 $result['video'] = array(
810 'attachUrl' => $attachment['attachUrl'], 821 'attachUrl' => $attachment['attachUrl'],
811 - 'orderBy' => $attachment['orderBy'],  
812 - 'img' => Helpers::getImageUrl($attachment['intro'], 290, 200) 822 + 'img' => Helpers::getImageUrl($attachment['intro'], 750, '')
813 ); 823 );
  824 + $result['orderBy'] = $attachment['orderBy'];
814 break; 825 break;
815 case 3: // 文本类型 826 case 3: // 文本类型
816 $result['text'] = array( 827 $result['text'] = array(
817 - 'intro' => $attachment['intro'],  
818 - 'orderBy' => $attachment['orderBy'] 828 + 'intro' => $attachment['intro']
819 ); 829 );
  830 + $result['orderBy'] = $attachment['orderBy'];
820 break; 831 break;
821 default: 832 default:
822 break; 833 break;
823 } 834 }
824 835
825 - if(count($result) > 1) {  
826 - Helpers::sortArrByField($result, 'orderBy');  
827 - }  
828 -  
829 return $result; 836 return $result;
830 } 837 }
831 838