Blame view

yohobuy/www.yohobuy.com/application/modules/Product/controllers/Sale.php 1.53 KB
yangyang authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php

use Action\WebAction;
use LibModels\Web\Product\SaleData;

/**
 * sale页
 *
 */
class SaleController extends WebAction 
{

    public function indexAction() 
    {
        //获取专区ID
whb authored
16
        $specialsaleId = $this->get('specialsale_id');
yangyang authored
17
        $specialInfo = SaleData::getSpecial($specialsaleId);
whb authored
18 19 20 21 22
        if(isset($specialInfo['data'])) {
            $special = $specialInfo['data'];
        } else {
            $special = array();
        }
yangyang authored
23
        //获取促销ID
whb authored
24
        $promotion = $this->get('promotion');
yangyang authored
25 26 27 28 29 30 31 32 33 34 35 36
        //专区ID和促销ID都为空时,跳转到主页
        if (empty($specialsaleId) && empty($promotion)) {
            $this->go(SITE_MAIN);
        }
        
        $condition = array();
        //传品牌ID参数
        if(!empty($special['brand_id'])){
            $condition['brand'] = $special['brand_id'];
        }
        //传促销id
        if(!empty($special['ispromotion'])){
yangyang authored
37
            $condition['promotion'] = $special['ispromotion'];
yangyang authored
38 39
        }else{
            $condition['promotion'] = $promotion;
yangyang authored
40 41 42
        }
        
        $options = array(
yangyang authored
43 44
            'specialsale_id' => 'Y',
            'controller' => $this->_request->controller
yangyang authored
45 46
        );
        
yangyang authored
47 48 49 50 51 52 53
        $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
        $data = array(
             //初始化js
            'productListPage' => true,
            'newSale' => $saleData
        );
        $this->setWebNavHeader();
yangyang authored
54 55 56 57 58
        //渲染模板
        $this->_view->display('new-sale', $data);
    }

}