Index.php 1.75 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');
    }

    /**
     * 公告
     */
    public function noticeAction()
    {
        if (!$this->isAjax()) {
            exit;
        }
        $notice = array();
        $data = IndexData::getNotice();
        do {
            if ($data['code'] != 200 || !isset($data['open']) || $data['open'] != 'Y' || !isset($data['open']) || empty($data['list'])) {
                break;
            }
            foreach ($data['list'] as $key => $val) {

            }
        } while(false);
        $this->echoJson($notice);
    }

}