Index.php 2.95 KB
<?php

use Action\WebAction;
use WebPlugin\Helpers;
use Home\UserModel;
use Home\IndexModel;
use LibModels\Web\Home\OrderData;

/**
 * 个人中心首页
 */
class IndexController extends WebAction
{

    /**
     * 个人中心首页
     */
    public function indexAction()
    {
        $uid = $this->auditJumpLogin(true, Helpers::url('/home'));
        //头部导航
        $channel = Helpers::getChannelNameByCookie();
        $this->setWebNavHeader($channel);
        //面包屑-左侧导航
        $path = array(
            array(
                'href' => SITE_MAIN,
                'name' => 'YOHO!BUY 有货首页'
            ),
            array(
                'name' => '个人中心'
            ),
        );
        $leftNav = UserModel::getCenterLeftNav('', $uid);
        $data = IndexModel::homeData();
        $udid = $uid . $this->getUdid();
        
        $channelNum = 1;
        switch ($channel) {
            case 'boys':
                $channelNum = 1;
                break;
            case 'girls':
                $channelNum = 2;
                break;
            case 'kids':
                $channelNum = 3;
                break;
            case 'lifestyle':
                $channelNum = 4;
                break;
            default:
                break;
        }
        // 为您优选 tar add 160701
        $data['recommend'] = IndexModel::preferenceData($channelNum, $uid, $udid, '100004', 30);

        //取消订单原因列表
        $resons = OrderData::closeReasons();
        $cancelReason = isset($resons['data']) ? $resons['data'] : '';

        $useInfo = UserModel::getUserInfo($uid);
        $data = array(
            'path' => $path,
            'userThumb' => UserModel::getUserHeadImg($uid),
            'homeNav' => $leftNav,
            'cancelReason' => $cancelReason,
            // 学生入口关闭,不展示学生身份认证信息
            'certifiedName' => UserModel::getStudentEntryStatus() ? false : ($useInfo['is_student'] ? '学生身份已验证' : '身份验证'),
            'certifiedUrl' => Helpers::url('/product/students/'),
            'content' => array(
                array(
                    //消息提示
                    'messages' => IndexModel::getInfoNumData($uid, $udid)
                ),
                array(
                    //最新订单
                    'latestOrders' => IndexModel::latestOrders($uid),
                    'favBrand' => array(
                        'more' => '/brands',
                        'brands' => $data['brand']
                    ),
                    'newArrival' => $data['new']
                )
            ),
            'recommend' => $data['recommend'], //待处理
            'banner' => IndexModel::getFooterBanner(),
            'helpUsUrl' => ''
        );
        $this->_view->display('index', array('meIndexPage' => true, 'me' => $data));
    }
}