<?php
/**
 * 品牌
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaol <1094186793@sina.cn>
 */
namespace Mobile\Controller;
class BrandController extends BaseController
{
    public function index()
    {
        $brand = D('Common/Brand')->get_brand_list();
        $this->assign('brandlist', $brand);
        $this->assign('tplseo_title', '品牌' . '_' . C('WEB_SITE_TITLE'));
        $this->assign('page_title', '品牌');
        $this->display();
    }

    public function cont()
    {
        $param=I('param.');
        $data=D('Common/Brand')->get_cont($param);
        if($data['status']==0)$this->error($data['msg']);
        $this->assign($data);
        $this->assign($param);
        $this->assign('tplseo_title',$data['brand']['brand_name'].'_'.C('WEB_SITE_TITLE'));
        $this->assign('page_title', $data['brand']['brand_name']);
        $this->assign('tplseo_keywords',empty($brand['brand']['seokeywords'])?$data['brand']['brand_name']:$brand['brand']['seokeywords']);
        $this->assign('tplseo_description',empty($brand['brand']['seodescription'])?$data['brand']['brand_name']:$brand['brand']['seodescription']);
        $this->display();
    }

    public function get_brand_list()
    {
        $param = I('param.');
        $cat_id = $param['cat_id'];
        $order = ' '.$param['order_name'].' '.$param['order_type'];
        $goods_map['brand_id']=$param['id'];
        if ($cat_id >0)$goods_map['cat_id']=$cat_id;
        $p=$param['page'];
        $return['status'] = 0;
        $data=D('Common/Goods')->get_goods_list(0,$goods_map,'',$order,$p);
        if(empty($data['list']))$this->ajaxReturn($return);
        $return['status'] = 1;
        $this->assign('list', $data['list']);
        $list_html = $this->fetch('goods_list');
        $return['data'] = $list_html;
        $this->ajaxReturn($return);
    }
}