Blame view

yohobuy/m.yohobuy.com/application/controllers/Boys.php 1.57 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 20 21
        if (null !== $this->get('go')) {
            // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
            Index\HomeModel::goSwitchChannel();
        }
hf authored
22 23
        // 设置COOKIE标识用户访问过该页面了
        Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
hf authored
24
hf authored
25 26 27
        // 设置网站标题
        $this->setTitle('男生首页');
        // 显示侧边栏
hf authored
28
        $this->setNavSide('boys');
29 30
        // 显示底部TAB
        $this->setNavFooterTab();
31
32 33 34
        // 渲染模板并输出
        $this->_view->display('index', array(
            'boysHomePage' => true,
hf authored
35
            'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
36
            'maybeLike' => true,
hf authored
37 38
            'content' => Index\HomeModel::getBoysFloor(),
            'pageFooter' => true,
39
        ));
hf authored
40
    }
41
42 43 44 45 46 47
    /**
     * 异步获取男首底部banner数据
     * @return string 底部Banner数据
     */
    public function bottomBannerAction()
    {
hf authored
48 49
        do {
            if (!$this->isAjax()) {
50 51 52 53
                break;
            }

            $channel = Helpers::getChannelByCookie();
hf authored
54 55 56
            $bottomBanner = Index\HomeModel::getBottomBanner($channel);
            if (empty($bottomBanner)) {
                break;
57
            }
58
hf authored
59 60
            $this->echoJson($bottomBanner);
        } while (false);
61 62

        echo ' ';
63 64
    }
hf authored
65
}