Authored by yangyang

list-index页完成

@@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
71 $controller = 'Index'; 71 $controller = 'Index';
72 $action = 'Index'; 72 $action = 'Index';
73 // 二级域名 73 // 二级域名
74 - if (2 === $level) { 74 + if (3 === $level) {
75 $subDomain = strval($hostParts[0]); 75 $subDomain = strval($hostParts[0]);
76 switch (strtolower($subDomain)) { 76 switch (strtolower($subDomain)) {
77 case 'www': // 主站 77 case 'www': // 主站
  1 +<?php
  2 +
  3 +namespace Product;
  4 +
  5 +use Plugin\HelperSearch;
  6 +use Product\SearchModel;
  7 +use Api\Yohobuy;
  8 +
  9 +/**
  10 + * list Index页模板数据模型
  11 + *
  12 + */
  13 +class IndexModel
  14 +{
  15 + const URI_INDEX_TBANNER = '/shops/service/v1/searchbanner';
  16 +
  17 + public static function getIndexData($customCondition, $customOptions)
  18 + {
  19 + $urlList = array();
  20 + $searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
  21 +
  22 + // 组合搜索商品url
  23 + $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
  24 +
  25 + // 组合搜索分类url
  26 + $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
  27 +
  28 + //用户浏览记录
  29 + //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
  30 +
  31 + //批量调接口获取数据
  32 + $result = Yohobuy::getMulti($urlList, array(), true);
  33 +
  34 + //调用接口获取list-index banner数据
  35 + $msort = $searchCondition['condition']['msort'];
  36 + $misort = $searchCondition['condition']['misort'];
  37 + $gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1;
  38 + $bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array(10,$msort,$misort,$gender,0,0,0,0,0));
  39 +
  40 + // 组织模板数据
  41 + $data = HelperSearch::getList($result, $searchCondition['options']);
  42 +
  43 + return $data;
  44 + }
  45 +
  46 +}
@@ -43,7 +43,6 @@ class SaleModel @@ -43,7 +43,6 @@ class SaleModel
43 } 43 }
44 $special = $specialInfo['data']; 44 $special = $specialInfo['data'];
45 } 45 }
46 -  
47 //Sale首页 banner数据 46 //Sale首页 banner数据
48 $data['saleBanner']['bannerHeight'] = $special['banner'][0]['height']; 47 $data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
49 $data['saleBanner']['img'] = $special['banner'][0]['img']; 48 $data['saleBanner']['img'] = $special['banner'][0]['img'];
@@ -51,8 +50,10 @@ class SaleModel @@ -51,8 +50,10 @@ class SaleModel
51 $data['saleTitle']['count'] = $data['totalCount']; 50 $data['saleTitle']['count'] = $data['totalCount'];
52 51
53 //获取广告位数据 52 //获取广告位数据
54 - $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);  
55 - $data['leftContent'][]['picLink']['list'] = $nodeContent; 53 + if (isset($special['left_ad_code'])) {
  54 + $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
  55 + $data['leftContent'][]['picLink']['list'] = $nodeContent;
  56 + }
56 57
57 return $data; 58 return $data;
58 } 59 }
@@ -5,7 +5,17 @@ class ListController extends WebAction @@ -5,7 +5,17 @@ class ListController extends WebAction
5 { 5 {
6 public function indexAction() 6 public function indexAction()
7 { 7 {
  8 + $condition = array();
  9 + $options = array();
  10 + $indexData = Product\IndexModel::getIndexData($condition, $options);
8 11
  12 + $data = array(
  13 + //初始化js
  14 + 'productListPage' => true,
  15 + 'list' => $indexData
  16 + );
  17 + $this->setWebNavHeader();
  18 + $this->_view->display('list', $data);
9 } 19 }
10 20
11 /** 21 /**