New.php 1.6 KB
<?php

namespace Product;

use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Plugin\HelperSearch;
use \LibModels\Web\Product\SearchData as Search;
use Plugin\Images;
/**
 * sale首页模板数据模型
 *
 */
class NewModel 
{

    public static function getNewSearchData($params, $options) 
    {
        $data = array();
        // 调用接口查询商品数据
        $result = SearchData::searchElasticByCondition($params);
        if (isset($result['code']) && $result['code'] === 200) {
            // 调用分类信息
            $category = Search::getClassesData();
            if (isset($category['code']) && $category['code'] === 200) {
                $result['data']['filter']['group_sort'] = $category['data']['sort'];
            }
            // 调用折扣区间
            $discount = Search::getDiscount();
            if (isset($discount['code']) && $discount['code'] === 200) {
                $result['data']['filter']['discount'] = $discount['data']['discount'];
            }
            // 调用最新上架
            $recent = Search::recentShelve();
            if (isset($discount['code']) && $discount['code'] === 200) {
                $result['data']['filter']['recent'] = $recent['data']['recent'];
            }
            //用户浏览记录
            $result['data']['filter']['review'] = Search::getRecentReview();
            // 组织模板数据
            $data = HelperSearch::getList($result, $options);
        }
        
        return array(
            'productListPage' => true,
            'newSale' => $data
        );
    }

}