Index.php 1.5 KB
<?php 
use Action\WebAction;
use LibModels\Web\Product\BrandData;

class IndexController extends WebAction
{
    /**
     * 品牌首页
     */
    public function brandAction()
    {
        //品牌域名
        $domain = $this->param('named');
        if (empty($domain)) {
            $this->go(SITE_MAIN);
        }    
        $uid = $this->getUid();
        //根据品牌域名获取品牌id(同时判断品牌域名是否有效)
        $brandInfo = BrandData::getBrandLogoByDomain($domain);
        if (!empty($brandInfo['data']) && $brandInfo['code'] === 200) {
            $brandId = $brandInfo['data']['id'];
            $node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false;
        } else {
            $this->go(SITE_MAIN);
        }
        
        //品牌ID参数
        $condition = array();
        $condition['brand'] = $brandId;
        
        //$options参数数组
        $options = array();
        $options['brandName'] = $domain;
        $options['uid'] = $uid;
        $options['brandId'] = $brandId;
        $options['node'] = $node;
        
        //调用模型获得数据
        $data = Product\BrandsModel::getBrandSearchData($condition, $options);
        $data = array(
            //初始化js
            'searchListPage' => true,
            'list' => $data
        );
        
        $this->setWebNavHeader();
        //渲染模板
        $this->_view->display('list',$data);
    }
}
?>