Authored by yangyang

完成list-index页banner

@@ -663,7 +663,7 @@ @@ -663,7 +663,7 @@
663 keyEntry: [ 663 keyEntry: [
664 { 664 {
665 name: '', 665 name: '',
666 - link: '' 666 + url: ''
667 }, 667 },
668 ... 668 ...
669 ], 669 ],
@@ -31,18 +31,42 @@ class IndexModel @@ -31,18 +31,42 @@ class IndexModel
31 //批量调接口获取数据 31 //批量调接口获取数据
32 $result = Yohobuy::getMulti($urlList, array(), true); 32 $result = Yohobuy::getMulti($urlList, array(), true);
33 33
  34 + // 组织模板数据
  35 + $data = HelperSearch::getList($result, $searchCondition['options']);
  36 +
34 //调用接口获取list-index banner数据 37 //调用接口获取list-index banner数据
35 $msort = isset($searchCondition['condition']['msort']) ? $searchCondition['condition']['msort'] : false; 38 $msort = isset($searchCondition['condition']['msort']) ? $searchCondition['condition']['msort'] : false;
36 $misort = isset($searchCondition['condition']['misort']) ? $searchCondition['condition']['misort'] : false; 39 $misort = isset($searchCondition['condition']['misort']) ? $searchCondition['condition']['misort'] : false;
  40 + $positionId = isset($searchCondition['options']['positionId']) ? $searchCondition['options']['positionId'] : '';
37 $gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1; 41 $gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1;
38 if ($msort && $misort) { 42 if ($msort && $misort) {
39 - $bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array(10,$msort,$misort,$gender,0,0,0,0,0)); 43 + $bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array($positionId,$msort,$misort,$gender,0,0,0,0,0));
  44 + if (isset($bannerData['code']) && $bannerData['code'] == '200') {
  45 + $banner = self::formatBanner($bannerData['data']);
  46 + }
  47 + }
  48 + //插入banner数据
  49 + if (!empty($banner)) {
  50 + $data['sortIntro'] = $banner;
40 } 51 }
41 52
42 - // 组织模板数据  
43 - $data = HelperSearch::getList($result, $searchCondition['options']);  
44 -  
45 return $data; 53 return $data;
46 } 54 }
47 55
  56 + //组织list-index banner数据
  57 + public static function formatBanner($bannerData)
  58 + {
  59 + $banner = array();
  60 + $banner['name'] = $bannerData['title'];
  61 + $banner['enName'] = $bannerData['subtitle'];
  62 + $banner['desc'] = $bannerData['intro'];
  63 + $banner['img'] = $bannerData['logo'];
  64 + foreach($bannerData['keyword'] as $key => $vo){
  65 + $banner['keyEntry'][$key]['name'] = $vo['word'];
  66 + $banner['keyEntry'][$key]['url'] = $vo['url'];
  67 + }
  68 +
  69 + return $banner;
  70 + }
  71 +
48 } 72 }
@@ -5,8 +5,12 @@ class ListController extends WebAction @@ -5,8 +5,12 @@ class ListController extends WebAction
5 { 5 {
6 public function indexAction() 6 public function indexAction()
7 { 7 {
  8 + //获取banner id
  9 + $positionId = 10; //搜素banner 位置id
8 $condition = array(); 10 $condition = array();
9 - $options = array(); 11 + $options = array(
  12 + 'positionId' => $positionId
  13 + );
10 $indexData = Product\IndexModel::getIndexData($condition, $options); 14 $indexData = Product\IndexModel::getIndexData($condition, $options);
11 15
12 $data = array( 16 $data = array(