Authored by Rock Zhang

xiangou

@@ -776,20 +776,22 @@ class DetailModel @@ -776,20 +776,22 @@ class DetailModel
776 $result['description'] = $product['description']; 776 $result['description'] = $product['description'];
777 777
778 // 附件 778 // 附件
779 - if (isset($product['attachment'])) {  
780 - foreach ($product['attachment'] as $item) {  
781 - if ($item['isDefault'] === 1) { // 排除默认图片  
782 - continue;  
783 - } 779 + if (!isset($product['attachment'])) {
  780 + break;
  781 + }
784 782
785 - $result['attaches'][] = self::procLimitProductAttach($item); 783 + $result['attaches'] = array();
  784 + foreach ($product['attachment'] as $item) {
  785 + if ($item['isDefault'] === 1) { // 排除默认图片
  786 + continue;
786 } 787 }
  788 +
  789 + $result['attaches'][] = self::procLimitProductAttach($item);
787 } 790 }
788 791
789 if(count($result['attaches']) > 1) { 792 if(count($result['attaches']) > 1) {
790 Helpers::sortArrByField($result['attaches'], 'orderBy', true); 793 Helpers::sortArrByField($result['attaches'], 'orderBy', true);
791 } 794 }
792 -  
793 } while (false); 795 } while (false);
794 796
795 return $result; 797 return $result;