Authored by 周少峰

数据分页不一致,添加搜索提示

... ... @@ -19,12 +19,9 @@ class SearchData extends \LibModels\Wap\Product\SearchData
case 'release':
if($type == 'sort'){
return 'http://100.98.132.63/yohosearch/sortgroup.json';
}elseif($type == 'discount'){
return 'http://100.98.132.63/yohosearch/discount.json';
}elseif($type == 'recent'){
return 'http://100.98.132.63/yohosearch/recent.json';
}elseif($type == 'review'){
}
elseif($type == 'suggest'){
return 'http://100.98.132.63/yohosearch/suggest.json';
}
return 'http://100.98.132.63/yohosearch/search.json';
case 'test':
... ... @@ -34,14 +31,10 @@ class SearchData extends \LibModels\Wap\Product\SearchData
if($type == 'sort'){
return 'http://101.200.31.165/yohosearch/sortgroup.json';
}
elseif($type == 'discount'){
return 'http://101.200.31.165/yohosearch/discount.json';
}
elseif($type == 'recent'){
return 'http://101.200.31.165/yohosearch/recent.json';
}elseif($type == 'review'){
return 'http://itemapi.yohobuy.com/item/item/recentreview';
elseif($type == 'suggest'){
return 'http://101.200.31.165/yohosearch/suggest.json';
}
return 'http://101.200.31.165/yohosearch/search.json';
}
}
... ... @@ -116,36 +109,19 @@ class SearchData extends \LibModels\Wap\Product\SearchData
}
/**
* 获取折扣区间
*/
public static function getDiscount(){
return Yohobuy::get(self::getUrl('discount'));
}
/**
* 获取最新上架
*/
public static function recentShelve(){
return Yohobuy::get(self::getUrl('recent'));
}
/**
* 搜索品牌店铺信息
* @param array $params 参数
* 获取搜索提示
* @param $param
* @param $cache
* @return array
*/
public static function getShop(array $params)
{
return Yohobuy::get(self::$shopsUrl,$params);
}
/**
* 获取最近浏览记录
* @param int $limit
* @return json
*/
public static function getRecentReview($limit = 0)
public static function getSuggest($param, $cache = false)
{
if (empty($param['query'])) {
return array();
}
if (empty($param['size'])) {
$param['size'] = 10;
}
return Yohobuy::get(self::getUrl('suggest'),$param, $cache);
}
}
\ No newline at end of file
... ...
... ... @@ -115,7 +115,7 @@ class HelperSearch
//品牌店铺信息
$result['shopEntry'] = isset($data['shop']) && !empty($data['shop']) ? self::shop($data['shop'], $data['sort']['sort']) : array();
//分页
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']-1);
//选中条件
if (self::getSelected()) {
$result['filters']['checkedConditions']['conditions'] = self::getSelected();
... ...
... ... @@ -196,4 +196,14 @@ class SearchModel
}
echo json_encode($data);
}
/**
* 查询搜索提示
* @param $query
*/
public static function getSuggest($query)
{
$result = SearchData::getSuggest();
return $result;
}
}
\ No newline at end of file
... ...
... ... @@ -27,6 +27,7 @@ class ListController extends WebAction
'productListPage' => true,
'list' => $list
);
$this->setWebNavHeader();
$this->_view->display('list', $data);
}
... ...
... ... @@ -15,4 +15,13 @@ class SearchController extends WebAction
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
public function suggest()
{
$query = rawurldecode($this->get('query'));
if ($query) {
$param['query'] = $query;
$result = SearchModel::getSuggest($param);
}
}
}
\ No newline at end of file
... ...