Authored by whb

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy.git into develop

@@ -1316,15 +1316,13 @@ class HelperSearch @@ -1316,15 +1316,13 @@ class HelperSearch
1316 */ 1316 */
1317 public static function getBannerFormat($banner, $brand) 1317 public static function getBannerFormat($banner, $brand)
1318 { 1318 {
1319 -  
1320 // 根据品牌Id获取品牌banner图 1319 // 根据品牌Id获取品牌banner图
1321 if (isset($banner['banner'])) { 1320 if (isset($banner['banner'])) {
1322 $bannerImg = Helpers::getImageUrl($banner['banner'], '', 150); 1321 $bannerImg = Helpers::getImageUrl($banner['banner'], '', 150);
1323 } 1322 }
1324 1323
1325 $is_favorite = false; 1324 $is_favorite = false;
1326 - $shopName = false;  
1327 - if(isset($brand)){ 1325 + if(isset($brand['is_favorite'])){
1328 // 获取是否收藏 1326 // 获取是否收藏
1329 if ($brand['is_favorite'] == 'Y') { 1327 if ($brand['is_favorite'] == 'Y') {
1330 $is_favorite = true; 1328 $is_favorite = true;
@@ -32,9 +32,9 @@ var _hmt = _hmt || []; @@ -32,9 +32,9 @@ var _hmt = _hmt || [];
32 })(); 32 })();
33 } 33 }
34 if (window.addEventListener) { 34 if (window.addEventListener) {
35 - window.addEventListener(type, async_load, false); 35 + window.addEventListener('load', async_load, false);
36 } else if (window.attachEvent) { 36 } else if (window.attachEvent) {
37 - window.attachEvent("on" + type, async_load); 37 + window.attachEvent('onload', async_load);
38 } 38 }
39 })(); 39 })();
40 </script> 40 </script>
@@ -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 = isset($searchCondition['condition']['msort']) ? $searchCondition['condition']['msort'] : false;
  36 + $misort = isset($searchCondition['condition']['misort']) ? $searchCondition['condition']['misort'] : false;
  37 + $gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1;
  38 + 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));
  40 + }
  41 +
  42 + // 组织模板数据
  43 + $data = HelperSearch::getList($result, $searchCondition['options']);
  44 +
  45 + return $data;
  46 + }
  47 +
  48 +}
@@ -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 //获取广告位数据
  53 + if (isset($special['left_ad_code'])) {
54 $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']); 54 $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
55 $data['leftContent'][]['picLink']['list'] = $nodeContent; 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 /**