Authored by hf

code review by fei.hong: modify boys home page check is girls channel

... ... @@ -7,7 +7,7 @@ server
# 频道相关
location = / {
proxy_redirect off;
proxy_pass http://yohobuy-pc;
proxy_pass http://yohobuy-pc-abtest;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
... ... @@ -46,7 +46,31 @@ server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /tools {
location = /brands {
proxy_redirect off;
proxy_pass http://yohobuy-pc;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /brands/plusstar {
proxy_redirect off;
proxy_pass http://yohobuy-pc;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /brands/brandList {
proxy_redirect off;
proxy_pass http://yohobuy-pc;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /brands/brandinfo {
proxy_redirect off;
proxy_pass http://yohobuy-pc;
proxy_set_header Host $host;
... ...
<?php
use Action\WebAction;
use Product\BrandsModel;
use LibModels\Web\Product\SearchData;
use Plugin\Helpers;
/**
* 品牌首页
*/
class BrandsController extends WebAction
{
public function brandsAction()
{
//品牌一览头部
$channelStr = $this->getCookie("_Channel");
$channel = empty($channelStr) ? 'boys': $channelStr;
$this->setWebNavHeader($channel);
//banner-list
$res = BrandsModel::getBrandView($channel);
//数据整合
$data = array(
'brandsHomePage' => true,
'brands' => array(
'category' => $res['brandList'],
'tabs' => $res['brandTop']
)
);
$this->_view->display('brands', $data);
}
/**
* 品牌接口数据
*
* @param string brandId 获取品牌ID
* @return json
*/
public function brandinfoAction()
{
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$brandId = $this->get('brandId', 0);
$uid = $this->getUid(false);
$data = BrandsModel::getBrandInfo($brandId, $uid);
$result = array(
'code' => 200,
'brand' => $data
);
}
while (false);
$this->echoJson($result);
}
/*
* 品牌list
*/
public function indexAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img01.yohoboys.com/staticimg/2015/11/26/17/01350e0e001b91af0fc91c974a772b931c.png';
$name_href = array(
'name' => '衣服',
'url' => ''
);
$name_href_img = array(
'href' => '',
'src' => $imgsrc,
'name' => '优显led触控台灯'
);
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
array(
'slide' => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
)
)
)
),
array(
'brand' => array(
'name' => '品牌 BRAND',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'singlegoods' => array(
'name' => '单品 SINGLE GOODS',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'video' => array(
'name' => '视频 VIDEO',
'navs' => array(
array(
'id' => '',
'href' => '',
'name' => '设计师品牌'
),
array(
'id' => '',
'href' => '',
'name' => '街头品牌'
),
array(
'id' => '',
'href' => '',
'name' => '明星品牌'
)
),
'list' => array(
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img,
$name_href_img
)
)
),
array(
'news' => array(
'name' => '新闻 NEWS',
"pics" => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg',
'tips' => '轻户外 TEENTEAM ,2015 A/W !'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg',
'tips' => '轻户外TEENTEAM ,2015 A/W !'
)
)
),
"txts" => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
),
array(
'href' => '/?gender=1,3',
'name' => '“轻户外” TEENTEAM ,2015 A/W “GOOUT TO HUNT ”系列新品上线!'
)
)
)
)
),
array(
'ads' => array(
'list' => array(
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
),
array(
'href' => '',
'src' => $imgsrc,
'name' => 'Vans联乘再次出击',
'des' => '携手印花大师Eley Kishimot'
)
)
)
)
)
);
$this->_view->display('index', $data);
}
/**
* 品牌列表
*/
public function listAction()
{
$headerdata = array(
'gobytype' => 'gobuyboys',
'searchcate' => 'searchcateboys',
'navbars' => array(
array(
'name_cn' => '男生',
'name_en' => 'BOYS',
'link' => '',
'classname' => 'boys',
'index_main' => 0,
'subnav' => array(
array(
'name' => '男首1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '男首3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
),
array(
'name_cn' => '女生',
'name_en' => 'GIRLS',
'link' => 'http=>//www.baidu.com',
'classname' => '',
'index_main' => 0,
'subnav' => array(
array(
'name' => '女生1',
'link' => '',
'index_sub' => 0,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生2',
'link' => '',
'index_sub' => 1,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
),
array(
'name' => '女生3',
'link' => '',
'index_sub' => 2,
'thirdnav' => array(
array(
'title' => '上装',
'branditems' => array(
array(
'brandname' => '背心',
'link' => ''
),
array(
'brandname' => 'T恤',
'link' => ''
)
)
)
)
)
)
)
),
'myyoho' => array(
'email' => 'hhh@126.com',
'viptype' => '普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' => '待处理的订单',
'link' => '',
'num' => '0'
),
array(
'name' => '我的收藏',
'link' => '',
'num' => '1'
),
array(
'name' => '我的优惠券',
'link' => '',
'num' => '2'
),
array(
'name' => '我的YOHO币',
'link' => '',
'num' => '1'
),
array(
'name' => '我的退货换货',
'link' => '',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy' => array(
'gobuynum' => 3
),
'breadcrumbnav' => array(
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend' => array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
$item1 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => ''
);
$item2 = array(
'name' => '所有品牌',
'src' => $imgsrc,
'url' => '',
'name' => 'Millefed',
'desc' => ' I.T于2006年冬季在香港推出最新品牌创始 人Shawn Stussy将滑板服、工作服、旧校 服的设计加入到 '
);
$data = array(
'brandsHomePage' => true,
'headerdata' => $headerdata,
'brands' => array(
'tabs' => array(
$item1,
$item1,
$item1,
$item1,
$item1
),
'items' => array(
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2,
$item2
)
)
);
$this->_view->display('list', $data);
}
}
... ... @@ -2,6 +2,7 @@
use Action\WebAction;
use Index\HomeModel;
use WebPlugin\Helpers;
/**
* 默认控制器
... ... @@ -14,9 +15,10 @@ class IndexController extends WebAction
*/
public function indexAction()
{
if (null !== $this->get('go')) {
// 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
HomeModel::goSwitchChannel();
// 判断是不是女生
$channel = Helpers::getChannelNameByCookie();
if ($channel === 'girls') {
$this->go(Helpers::url('/woman'));
} else {
// 设置客户端浏览器1分钟内不改变
$this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
... ...