Blame view

yohobuy/m.yohobuy.com/application/controllers/Boys.php 1.62 KB
hf authored
1
<?php
2
hf authored
3
use Action\AbstractAction;
4
use Plugin\Helpers;
hf authored
5
hf authored
6
/**
hf authored
7
 * 男生首页
hf authored
8 9 10
 */
class BoysController extends AbstractAction
{
11
12 13 14
    /**
     * 男生首页
     */
hf authored
15 16
    public function indexAction()
    {
17 18 19
        if (null !== $this->get('go')) {
            // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
            Index\HomeModel::goSwitchChannel();
hf authored
20
        } else {
21 22
            // 设置浏览器缓存5分钟
            $this->setExpires(300); // 缓存5分钟
23 24
        }
hf authored
25
        // 设置COOKIE标识用户访问过该页面了
hf authored
26
        // Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
hf authored
27
hf authored
28 29 30
        // 设置网站标题
        $this->setTitle('男生首页');
        // 显示侧边栏
hf authored
31
        $this->setNavSide('boys');
32 33
        // 显示底部TAB
        $this->setNavFooterTab();
34
35 36 37
        // 渲染模板并输出
        $this->_view->display('index', array(
            'boysHomePage' => true,
hf authored
38
            'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
39
            'maybeLike' => true,
hf authored
40 41
            'content' => Index\HomeModel::getBoysFloor(),
            'pageFooter' => true,
42
        ));
hf authored
43
    }
44
45 46 47 48 49 50
    /**
     * 异步获取男首底部banner数据
     * @return string 底部Banner数据
     */
    public function bottomBannerAction()
    {
hf authored
51 52
        do {
            if (!$this->isAjax()) {
53 54 55
                break;
            }
56
            $bottomBanner = Index\HomeModel::getBottomBanner(1);
hf authored
57 58
            if (empty($bottomBanner)) {
                break;
59
            }
60
hf authored
61 62
            $this->echoJson($bottomBanner);
        } while (false);
63 64

        echo ' ';
65 66
    }
hf authored
67
}