Authored by hf

fixes bug refs YW-1021

... ... @@ -60,8 +60,18 @@ class BrandModel
// 搜索链接地址
$result['searchUrl'] = Helpers::url('/brands/search', null);
/* 顶部的轮翻广告列表 */
if (!empty($brand['brandTop'][0]['data'])) {
/* 顶部的轮翻广告或热门品牌列表(当没有轮翻广告的情况下会是这个样子的! 此处是根据接口改造成的逻辑) */
if (!empty($brand['brandTop'][0]['data']['list'])) {
$build = array();
foreach ($brand['brandTop'][0]['data']['list'] as $value) {
$build['url'] = Helpers::getFilterUrl($value['url']);
$build['img'] = Helpers::getImageUrl($value['src'], 144, 144);
$build['name'] = $value['name'];
$result['hotBrand']['list'][] = $build;
}
}
// 顶部的轮翻广告列表
elseif (!empty($brand['brandTop'][0]['data'])) {
$build = array();
foreach ($brand['brandTop'][0]['data'] as $value) {
$build['url'] = Helpers::getFilterUrl($value['url']);
... ... @@ -71,7 +81,7 @@ class BrandModel
}
}
/* 顶部的热门品牌列表 */
/* 顶部的热门品牌列表 (备注: 当没有轮翻广告的时候,此处内部的foreach不会被执行) */
if (!empty($brand['brandTop'][1]['data']['list'])) {
$build = array();
foreach ($brand['brandTop'][1]['data']['list'] as $value) {
... ...
<?php
namespace Product;
use Configs\CacheConfig;
use LibModels\Wap\Product\SearchData;
use LibModels\Wap\Category\BrandData;
use LibModels\Wap\Category\ClassData;
use Plugin\DataProcess\ListProcess;
/**
* 搜索相关的模板数据模型
*
* @name Filter
* @package Product
* @copyright yoho.inc
* @version 1.0 (2015-11-1 17:35:52)
*/
class FilterModel
{
/**
* 获取筛选的数据
*
* @param array $condition 查询条件
* @return array
*/
public static function getFilterData($condition)
{
$result = array();
// 区别各种列表页面的筛选数据
if (isset($condition['brand'])) {
$listData = BrandData::filterBrandData($condition);
} else if(isset($condition['sort'])) {
$listData = ClassData::filterClassData($condition);
} else {
$listData = SearchData::searchByCondition($condition);
}
if (isset($listData['data']) && isset($listData['data']['filter'])) {
$result['filter'] = ListProcess::getFilterData($listData['data']['filter']);
}
return $result;
}
}