...
|
...
|
@@ -142,20 +142,35 @@ class SearchData extends \LibModels\Wap\Product\SearchData |
|
|
*/
|
|
|
public static function getSearchDataBySort(array $params, array $sortList)
|
|
|
{
|
|
|
$data = array();
|
|
|
foreach ($sortList as $v) {
|
|
|
if(empty($v['viewNum'])){
|
|
|
continue;
|
|
|
}
|
|
|
$searchParams = array_merge($params, $v);
|
|
|
$list = self::searchElasticByCondition($searchParams, true);
|
|
|
$productList = empty($list['data']['product_list']) ? array() : $list['data']['product_list'];
|
|
|
if(count($productList) < $v['viewNum']){
|
|
|
continue;
|
|
|
}
|
|
|
$data = array_merge($data, $productList);
|
|
|
// $data = array();
|
|
|
// foreach ($sortList as $v) {
|
|
|
// if(empty($v['viewNum'])){
|
|
|
// continue;
|
|
|
// }
|
|
|
// $searchParams = array_merge($params, $v);
|
|
|
// $list = self::searchElasticByCondition($searchParams, true);
|
|
|
// $productList = empty($list['data']['product_list']) ? array() : $list['data']['product_list'];
|
|
|
// if(count($productList) < $v['viewNum']){
|
|
|
// continue;
|
|
|
// }
|
|
|
// $data = array_merge($data, $productList);
|
|
|
// }
|
|
|
// return $data;
|
|
|
|
|
|
/* 2016/01/26 code review by fei.hong: 优化合并misort参数, 减少调用搜索的次数 */
|
|
|
$sortIds = '';
|
|
|
$viewNum = 0;
|
|
|
foreach ($sortList as $value) {
|
|
|
$viewNum += intval($value['viewNum']);
|
|
|
$sortIds .= $value['misort'] . ',';
|
|
|
}
|
|
|
$params['viewNum'] = $viewNum;
|
|
|
$params['misort'] = rtrim($sortIds, ',');
|
|
|
$searchd = self::searchElasticByCondition($params);
|
|
|
if (empty($searchd['data']['product_list'])) {
|
|
|
return array();
|
|
|
}
|
|
|
return $data;
|
|
|
return $searchd['data']['product_list'];
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|