Lifestyle.php 11.2 KB
<?php
use Action\AbstractAction;

/**
 * 创意生活首页
 */
class LifestyleController extends AbstractAction
{
    public function indexAction()
    {

        $headerdata = array(
            'gobytype' =>'gobuyboys',
            'searchcate'=> 'searchcateboys',
            'navbars' => array(
                array(
                    'name_cn'=>'男生',
                    'name_en'=>'BOYS',
                    'link' => '',
                    'classname' => 'boys',
                    'index_main' => 0,
                    'subnav' => array(
                        array(
                            'name'=>'男首1',
                            'link'=>'',
                            'index_sub'=>0,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )

                                )
                             )
                        ),
                        array(
                            'name'=>'男首2',
                            'link'=>'',
                            'index_sub'=>1,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )
                                )
                             )
                         ),
                        array(
                            'name'=>'男首3',
                            'link'=>'',
                            'index_sub'=>2,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )
                                )
                             )
                        )
                    )
                ),
                array(
                    'name_cn'=>'女生',
                    'name_en'=>'GIRLS',
                    'link' => 'http=>//www.baidu.com',
                    'classname' => '',
                    'index_main' => 0,
                    'subnav' => array(
                        array(
                            'name'=>'女生1',
                            'link'=>'',
                            'index_sub'=>0,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )
                                )
                             )
                        ),
                        array(
                            'name'=>'女生2',
                            'link'=>'',
                            'index_sub'=>1,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )
                                )
                             )
                        ),
                        array(
                            'name'=>'女生3',
                            'link'=>'',
                            'index_sub'=>2,
                            'thirdnav' => array(
                                array(
                                    'title' =>'上装',
                                    'branditems'=> array(
                                        array(
                                            'brandname'=>'背心',
                                            'link'=>''
                                        ),
                                        array(
                                            'brandname'=>'T恤',
                                            'link'=>''
                                        )
                                    )
                                )
                             )
                        )
                    )
                )
            ),
            'myyoho' => array(
                'email'=>'hhh@126.com',
                'viptype'=>'普通会员',
                'currentscore' => 495,
                'totalscore' => 600,
                'cardtype' => '银卡',
                'infolist' =>  array(
                    array(
                        'name' =>'待处理的订单',
                        'link' =>'',
                        'num' => '0'
                    ),
                    array(
                        'name' =>'我的收藏',
                        'link' =>'',
                        'num' => '1'
                    ),
                    array(
                        'name' =>'我的优惠券',
                        'link' =>'',
                        'num' => '2'
                    ),
                    array(
                        'name' =>'我的YOHO币',
                        'link' =>'',
                        'num' => '1'
                    ),
                    array(
                        'name' =>'我的退货换货',
                        'link' =>'',
                        'num' => '1'
                    )
                ),
                'updlink' => ''
            ),
            'gobuy'=> array(
                'gobuynum' =>3
            ),
            'breadcrumbnav'=> array(
                array(
                    'notend'=>array(
                        'link' => 'http=>//www.baidu.com',
                        'name' => 'BOYS首页'
                    ) 
                ),
                array(
                    'notend'=>array(
                    'link' => 'http=>//www.baidu.com',
                    'name' => '上衣'
                    ) 
                ),
                array(
                    'isend'=>array(
                    'link' => 'http=>//www.baidu.com',
                    'name' => '衬衫'
                    ) 
                )
            )
        );
        $data = array(
            'headerdata' => $headerdata,
            'boysHomePage' => true,
            'lifestyle' => array(
                array(
                    'newArrivls' => array(
                        'name' => '最新上架  NEW ARRIVALS',
                        'navs' => array(
                            array(
                                'id' => '',
                                'href' => '',
                                'name' => 'MORE'
                            )
                        )
                    )
                )
            )
        );
        $this->_view->display('index', $data);
    }




    /**
     * 男装首页 新品上架 接口数据
     * 
     * @param int pageIndex 当前页数
     * @param int pageCount 一页显示个数
     * @param string flag 类型(男装/女装等,用于区分)
     * @return json
     */
    public function commodityAction()
    {
        $result = array();

        do {
            /* 判断是不是AJAX请求 */
            if (!$this->isAjax()) {
                break;
            }
            $pageIndex = $this->post('pageIndex');
            if($pageIndex>=3){
                break;
            }
            $imgsrc='http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
            $result=array(
                'code'=>200,
                'commodity'=>array(
                    array(
                        'url' =>'http://www.muji.com.cn/cn/store/goods/4547315967308' ,
                        'img'=> $imgsrc,
                        'name'=> '优显led触控台灯',
                        'price'=> 168,
                        'state'=> 1 //状态
                    ),
                    array(
                        'url' =>'http://www.muji.com.cn/cn/store/goods/4547315967308' ,
                        'img'=> $imgsrc,
                        'name'=> '优显led触控台灯',
                        'price'=> 168,
                        'state'=> 1 //状态
                    ),
                    array(
                        'url' =>'http://www.muji.com.cn/cn/store/goods/4547315967308' ,
                        'img'=> $imgsrc,
                        'name'=> '优显led触控台灯',
                        'price'=> 168,
                        'state'=> 1 //状态
                    ),
                    array(
                        'url' =>'http://www.muji.com.cn/cn/store/goods/4547315967308' ,
                        'img'=> $imgsrc,
                        'name'=> '优显led触控台灯',
                        'price'=> 168,
                        'state'=> 1 //状态
                    ),
                    array(
                        'url' =>'http://www.muji.com.cn/cn/store/goods/4547315967308' ,
                        'img'=> $imgsrc,
                        'name'=> '优显led触控台灯',
                        'price'=> 168,
                        'state'=> 1 //状态
                    )
                )
            );
        } while (false);

        $this->echoJson($result);
    }
}