Authored by hf

fixes bug refs YW-1021

@@ -60,8 +60,18 @@ class BrandModel @@ -60,8 +60,18 @@ class BrandModel
60 // 搜索链接地址 60 // 搜索链接地址
61 $result['searchUrl'] = Helpers::url('/brands/search', null); 61 $result['searchUrl'] = Helpers::url('/brands/search', null);
62 62
63 - /* 顶部的轮翻广告列表 */  
64 - if (!empty($brand['brandTop'][0]['data'])) { 63 + /* 顶部的轮翻广告或热门品牌列表(当没有轮翻广告的情况下会是这个样子的! 此处是根据接口改造成的逻辑) */
  64 + if (!empty($brand['brandTop'][0]['data']['list'])) {
  65 + $build = array();
  66 + foreach ($brand['brandTop'][0]['data']['list'] as $value) {
  67 + $build['url'] = Helpers::getFilterUrl($value['url']);
  68 + $build['img'] = Helpers::getImageUrl($value['src'], 144, 144);
  69 + $build['name'] = $value['name'];
  70 + $result['hotBrand']['list'][] = $build;
  71 + }
  72 + }
  73 + // 顶部的轮翻广告列表
  74 + elseif (!empty($brand['brandTop'][0]['data'])) {
65 $build = array(); 75 $build = array();
66 foreach ($brand['brandTop'][0]['data'] as $value) { 76 foreach ($brand['brandTop'][0]['data'] as $value) {
67 $build['url'] = Helpers::getFilterUrl($value['url']); 77 $build['url'] = Helpers::getFilterUrl($value['url']);
@@ -71,7 +81,7 @@ class BrandModel @@ -71,7 +81,7 @@ class BrandModel
71 } 81 }
72 } 82 }
73 83
74 - /* 顶部的热门品牌列表 */ 84 + /* 顶部的热门品牌列表 (备注: 当没有轮翻广告的时候,此处内部的foreach不会被执行) */
75 if (!empty($brand['brandTop'][1]['data']['list'])) { 85 if (!empty($brand['brandTop'][1]['data']['list'])) {
76 $build = array(); 86 $build = array();
77 foreach ($brand['brandTop'][1]['data']['list'] as $value) { 87 foreach ($brand['brandTop'][1]['data']['list'] as $value) {
1 -<?php  
2 -  
3 -namespace Product;  
4 -  
5 -use Configs\CacheConfig;  
6 -use LibModels\Wap\Product\SearchData;  
7 -use LibModels\Wap\Category\BrandData;  
8 -use LibModels\Wap\Category\ClassData;  
9 -use Plugin\DataProcess\ListProcess;  
10 -  
11 -/**  
12 - * 搜索相关的模板数据模型  
13 - *  
14 - * @name Filter  
15 - * @package Product  
16 - * @copyright yoho.inc  
17 - * @version 1.0 (2015-11-1 17:35:52)  
18 - */  
19 -class FilterModel  
20 -{  
21 -  
22 - /**  
23 - * 获取筛选的数据  
24 - *  
25 - * @param array $condition 查询条件  
26 - * @return array  
27 - */  
28 - public static function getFilterData($condition)  
29 - {  
30 - $result = array();  
31 -  
32 - // 区别各种列表页面的筛选数据  
33 - if (isset($condition['brand'])) {  
34 - $listData = BrandData::filterBrandData($condition);  
35 - } else if(isset($condition['sort'])) {  
36 - $listData = ClassData::filterClassData($condition);  
37 - } else {  
38 - $listData = SearchData::searchByCondition($condition);  
39 - }  
40 -  
41 - if (isset($listData['data']) && isset($listData['data']['filter'])) {  
42 - $result['filter'] = ListProcess::getFilterData($listData['data']['filter']);  
43 - }  
44 -  
45 - return $result;  
46 - }  
47 -  
48 -}