Authored by hf

code review by fei.hong: do format new arrival codes

@@ -604,18 +604,14 @@ class Process @@ -604,18 +604,14 @@ class Process
604 // single_image & floor & single_image 604 // single_image & floor & single_image
605 $list = array_merge($data[$key + 1]['data'], array_slice($data[$key + 2]['data'], 0, 6), $data[$key + 3]['data']); 605 $list = array_merge($data[$key + 1]['data'], array_slice($data[$key + 2]['data'], 0, 6), $data[$key + 3]['data']);
606 foreach ($list as $listKey => $val) { 606 foreach ($list as $listKey => $val) {
607 - $width = 185;  
608 - $height = 248;  
609 - $w = 377;  
610 - $h = 504;  
611 if ($listKey == 0 || $listKey == 7) { 607 if ($listKey == 0 || $listKey == 7) {
612 - $val['src'] = Images::getImageUrl($val['src'], $w, $h, 1); 608 + $val['src'] = Images::getImageUrl($val['src'], 377, 504, 1);
613 $result['newReport']['list'][] = array( 609 $result['newReport']['list'][] = array(
614 'href' => $val['url'], 610 'href' => $val['url'],
615 'img' => $val['src'] 611 'img' => $val['src']
616 ); 612 );
617 } else { 613 } else {
618 - $val['src'] = Images::getImageUrl($val['src'], $width, $height, 1); 614 + $val['src'] = Images::getImageUrl($val['src'], 185, 248, 1);
619 $result['newReport']['list'][] = array( 615 $result['newReport']['list'][] = array(
620 'href' => $val['url'], 616 'href' => $val['url'],
621 'img' => $val['src'] 617 'img' => $val['src']
@@ -656,6 +652,8 @@ class Process @@ -656,6 +652,8 @@ class Process
656 $result['category']['navs'] = self::mergeNavProcess($data[$key + 1], $type); 652 $result['category']['navs'] = self::mergeNavProcess($data[$key + 1], $type);
657 } 653 }
658 // floor模版 654 // floor模版
  655 + $width = 0;
  656 + $height = 0;
659 foreach ($data[$key + 2]['data'] as $pos => $val) { 657 foreach ($data[$key + 2]['data'] as $pos => $val) {
660 $width = 185; $height = 510; 658 $width = 185; $height = 510;
661 if($pos == 1) { 659 if($pos == 1) {
@@ -761,8 +759,9 @@ class Process @@ -761,8 +759,9 @@ class Process
761 { 759 {
762 $result = array(); 760 $result = array();
763 foreach ($data['data'] as $val) { 761 foreach ($data['data'] as $val) {
764 - if (empty($val)) 762 + if (empty($val)) {
765 continue; 763 continue;
  764 + }
766 $result[] = array( 765 $result[] = array(
767 'href' => $val['url'], 766 'href' => $val['url'],
768 'name' => $val['name'] 767 'name' => $val['name']
@@ -790,8 +789,10 @@ class Process @@ -790,8 +789,10 @@ class Process
790 'client_type' => 'web' 789 'client_type' => 'web'
791 ); 790 );
792 $goodsList = SearchData::searchElasticByCondition($params, false); 791 $goodsList = SearchData::searchElasticByCondition($params, false);
793 - $goodsList = $goodsList['data']['product_list']; 792 + $goodsList = empty($goodsList) ? array() : $goodsList['data']['product_list'];
794 $pos = 0; 793 $pos = 0;
  794 + $url = '';
  795 + $oneGoods = array();
795 foreach ($goodsList as $goods) 796 foreach ($goodsList as $goods)
796 { 797 {
797 $oneGoods = array(); 798 $oneGoods = array();
@@ -802,10 +803,10 @@ class Process @@ -802,10 +803,10 @@ class Process
802 if (empty($goods)) { 803 if (empty($goods)) {
803 continue; 804 continue;
804 } 805 }
  806 + $url = Helpers::getUrlBySkc($goods['product_id'], $goods['goods_list'][0]['goods_id'], $goods['cn_alphabet']);
805 $oneGoods['img'] = Images::getImageUrl($goods['goods_list'][0]['images_url'], 280, 373, 1); 807 $oneGoods['img'] = Images::getImageUrl($goods['goods_list'][0]['images_url'], 280, 373, 1);
806 $oneGoods['name'] = $goods['product_name']; 808 $oneGoods['name'] = $goods['product_name'];
807 $oneGoods['price'] = $goods['sales_price']; 809 $oneGoods['price'] = $goods['sales_price'];
808 - $url = Helpers::getUrlBySkc($goods['product_id'], $goods['goods_list'][0]['goods_id'], $goods['cn_alphabet']);  
809 $oneGoods['href'] = Helpers::transUrl($url, $type); 810 $oneGoods['href'] = Helpers::transUrl($url, $type);
810 $result[$goods['product_skn']] = $oneGoods; 811 $result[$goods['product_skn']] = $oneGoods;
811 } 812 }
@@ -838,7 +839,6 @@ class Process @@ -838,7 +839,6 @@ class Process
838 public static function mergeHotBrandsData($key,array &$data,$type) 839 public static function mergeHotBrandsData($key,array &$data,$type)
839 { 840 {
840 $result = array(); 841 $result = array();
841 - $temp = array();  
842 if ($data[$key]['template_name'] == 'custom_brands') 842 if ($data[$key]['template_name'] == 'custom_brands')
843 { 843 {
844 $result = array( 844 $result = array(
@@ -858,9 +858,7 @@ class Process @@ -858,9 +858,7 @@ class Process
858 $brands = $data[$key]['data']['list']; 858 $brands = $data[$key]['data']['list'];
859 foreach ($brands as $val) 859 foreach ($brands as $val)
860 { 860 {
861 - $width = 185;  
862 - $height = 86;  
863 - $val['src'] = Images::getImageUrl($val['src'], $width, $height, 2); 861 + $val['src'] = Images::getImageUrl($val['src'], 185, 86, 2);
864 $val['url'] = Helpers::transUrl($val['url'], $type); 862 $val['url'] = Helpers::transUrl($val['url'], $type);
865 $floor['logoBrand'][] = array( 863 $floor['logoBrand'][] = array(
866 'href' => $val['url'], 864 'href' => $val['url'],
@@ -868,10 +866,10 @@ class Process @@ -868,10 +866,10 @@ class Process
868 ); 866 );
869 } 867 }
870 $floor['moreBrand'] = Helpers::url('/brands'); 868 $floor['moreBrand'] = Helpers::url('/brands');
871 - $type_key = sprintf("%s_%s", $type, $key);  
872 - $cacheKey = sprintf("%s_%s", WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA, $type_key); 869 + $typeKey = sprintf("%s_%s", $type, $key);
  870 + $cacheKey = sprintf("%s_%s", WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA, $typeKey);
873 Cache::set($cacheKey, $floor, 86400); 871 Cache::set($cacheKey, $floor, 86400);
874 - $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key; 872 + $result['hotBrands']['brandUrl'] = Helpers::url('/common/getIndexResourceBrand', array('type' => $typeKey));
875 } 873 }
876 return $result; 874 return $result;
877 } 875 }