|
|
<?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;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|