Authored by hf

fixes bug to search list page show brand

... ... @@ -16,6 +16,7 @@ use Api\Sign;
*/
class BrandData
{
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
/**
... ... @@ -32,13 +33,13 @@ class BrandData
public static function package($contentCode, $channel)
{
$urlList = array();
/* 顶部的轮翻广告及热门品牌数据 */
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
$urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
/* 按字母"A-Z"分组的品牌列表数据 */
$param = Yohobuy::param();
$param['method'] = 'app.brand.brandlist';
... ... @@ -48,7 +49,7 @@ class BrandData
return Yohobuy::getMulti($urlList);
}
/**
* 获取品牌数据
*
... ... @@ -98,7 +99,7 @@ class BrandData
$param['uid'] = $uid;
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
$cache = empty($uid) ? 3600 : false;
return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时
... ... @@ -165,8 +166,8 @@ class BrandData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
/**
* 查询商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
... ... @@ -182,15 +183,21 @@ class BrandData
* @param integer $channel 表示频道号,1位男生,2为女生
* @return array 品类商品数据
*/
public static function filterBrandData($condition, $order = 's_t_desc', $limit = 60, $page = 1)
public static function filterBrandData($condition)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.brand';
$param['page'] = $page;
$param['limit'] = $limit;
$param['order'] = $order;
$param += $condition;
$param['client_secret'] = Sign::getSign($param);
if (!isset($param['order'])) {
$param['order'] = 's_t_desc';
}
if (!isset($param['limit'])) {
$param['limit'] = 60;
}
if (!isset($param['page'])) {
$param['page'] = 1;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -92,15 +92,21 @@ class ClassData
* @param integer $channel 表示频道号,1位男生,2为女生
* @return array 品类商品数据
*/
public static function filterClassData($condition, $order = 's_t_desc', $limit = 60, $page = 1)
public static function filterClassData($condition)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.category';
$param['page'] = $page;
$param['limit'] = $limit;
$param['order'] = $order;
$param += $condition;
$param['client_secret'] = Sign::getSign($param);
if (!isset($param['order'])) {
$param['order'] = 's_t_desc';
}
if (!isset($param['limit'])) {
$param['limit'] = 60;
}
if (!isset($param['page'])) {
$param['page'] = 1;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -171,6 +171,7 @@ class SearchController extends AbstractAction
$data['goodListPage'] = true;
$data['goodList'] = $condition;
$data['query'] = $query;
// 查询数据
if (!isset($condition['query'])) {
... ... @@ -233,9 +234,19 @@ class SearchController extends AbstractAction
}
$data = array();
// 查询品类数据
// 查询品类或品牌数据
if (!isset($condition['query'])) {
$data += Product\ListModel::getClassData($condition, $order, $page);
$condition['order'] = $order;
$condition['page'] = $page;
// 搜索品类
if (!isset($condition['brand'])) {
$data += Product\ListModel::getClassData($condition);
}
// 搜索品牌
else {
$title = '';
$data += Product\ListModel::getBrandData($condition, $title);
}
if (isset($data['filter'])) {
unset($data['filter']);
}
... ...