New.php 3.5 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);
            
            //new页面模拟数据
            $data['newMain'] = array(
                'banner' => 'http://img11.static.yhbimg.com/yhb-img01/2015/11/23/07/010a459d41b99a839cba9377532f1c19b2.jpg?imageView/3/w/970/h/200',
                    'date' => '12月16日',
                    'title' => '新品到着',
                    'brands' => array(
                        array(
                            'href' => '',
                            'logo' => 'http://img13.static.yhbimg.com/brandLogo/2012/02/28/15/02b2b5ded161ab31e2e097a327ed475052.jpg?imageView/2/w/170/h/120'
                        ),
                        array(
                            'href' => '',
                            'logo' => 'http://img13.static.yhbimg.com/brandLogo/2012/11/09/09/023721f44182f775d79904010af421331e.jpg?imageView/2/w/170/h/120'
                        ),
                        array(
                            'href' => '',
                            'logo' => 'http://img11.static.yhbimg.com/brandLogo/2012/12/13/17/01408fb72646c8f3fa59d870514f08a356.jpg?imageView/2/w/170/h/120'
                        ),
                        array(
                            'href' => '',
                            'logo' => 'http://img13.static.yhbimg.com/brandLogo/2012/12/24/13/0265b45e37af697c5ba12d5415fb341f27.jpg?imageView/2/w/170/h/120'
                        ),
                        array(
                            'href' => '',
                            'logo' => 'http://img11.static.yhbimg.com/brandLogo/2015/08/11/15/012d09a5cae187af1f6f3ed246b9b5a4fc.jpg?imageView/2/w/170/h/120'
                        ),
                        array(
                            'href' => '',
                            'logo' => 'http://img11.static.yhbimg.com/brandLogo/2015/08/20/16/01047ffb3ca182871821d551af31ac2378.jpg?imageView/2/w/170/h/120'
                        )
                    )
            );
        }
        
        return array(
            'productListPage' => true,
            'newSale' => $data
        );
    }

}