Index.php 1.24 KB
<?php

use Action\AbstractAction;
use Plugin\Helpers;
use LibModels\Wap\Home\IndexData;

/**
 * 频道选择
 */
class IndexController extends AbstractAction
{

    /**
     * 频道选择页
     */
    public function indexAction()
    {
        if (null !== $this->get('go')) {
            // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
            Index\HomeModel::goSwitchChannel();
        } else {
            // 设置客户端浏览器1小时内不改变, 
            $this->setLastModified(mktime(date('H'), 0, 0, date('n'), date('j'), date('Y')));
            // 设置浏览器缓存5分钟
            $this->setExpires(300);
        }

        $result = Index\HomeModel::getChannel();
        $result['background'] = Index\HomeModel::getBgImage();
        $result['channelPage'] = true;
        $result['showDownloadApp'] = true;
        $result['searchUrl'] = Helpers::url('', null, 'search');
        $result['pageFooter'] = true;

        // 渲染模板
        $this->_view->display('index', $result);
    }

    /**
     * 设置升级公告路由
     * 
     */
    public function systemUpdateAction()
    {
        $this->setTitle('关于系统升级的公告');

        $this->_view->display('systemUpdate');
    }

}