SearchData.php 909 Bytes
<?php
namespace LibModels\Web\Product;

class SearchData extends \LibModels\Wap\Product\SearchData
{
    /**
     * 根据分类列表获取商品信息
     * 
     * @param array $params
     * @param array $sortList
     * @return array
     */
    public static function getSearchDataBySort(array $params, array $sortList)
    {
        $data = array();
        foreach ($sortList as $v) {
            if(empty($v['viewNum'])){
                continue;
            }
            $params = array_merge($params, $v);
            $list = self::searchElasticByCondition($params, 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;
    }
}