Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -296,17 +296,17 @@ class AbstractAction extends Controller_Abstract
/**
* 设置网站导航头部信息
*
* @param string $backUrl 返回的链接
* @param string $title 头部标题
* @param string $backUrl 返回的链接
* @param string $homeUrl 返回首页的链接
* @return void
*/
protected function setNavHeader($backUrl, $title, $homeUrl)
protected function setNavHeader($title = '', $backUrl = true, $homeUrl = '/')
{
$header = array();
if (!empty($backUrl)) {
$header['navBack'] = $backUrl;
if ($backUrl) {
$header['navBack'] = true;
}
if (!empty($title)) {
$header['navTitle'] = $title;
... ...
... ... @@ -16,12 +16,43 @@ use Api\Sign;
*/
class BrandData
{
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
/**
* 封装获取品牌一览页面的数据
*
* @param string $contentCode 获取广告资源需要的位置码
* @param int $channel 频道标识 1:男,2:女,3:潮童,4:创意生活
* @return array(
* "brandTop": "顶部的轮翻广告及热门品牌数据",
* "brandList": "按字母'A-Z'分组的品牌列表数据"
* )
* @author fei.hong <fei.hong@yoho.cn>
*/
public static function package($contentCode, $channel)
{
$urlList = array();
/* 顶部的轮翻广告及热门品牌数据 */
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
$urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
/* 按字母"A-Z"分组的品牌列表数据 */
$param = Yohobuy::param();
$param['method'] = 'app.brand.brandlist';
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
$urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList);
}
/**
* 获取品牌数据
*
* @param integer $channel 是否,默认1表示是,传值为空是app中用于品牌搜索的数据
*
* @return array 品牌数据
*/
public static function getBrandsData($channel = 1)
... ... @@ -38,16 +69,17 @@ class BrandData
/**
* 获取品牌页顶部楼层数据
*
* @param string $contentCode 位置码
* @return array 品牌也顶部楼层数据
*/
public static function getBrandTopData()
public static function getBrandTopData($contentCode)
{
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a';
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
}
/**
... ...
... ... @@ -10,15 +10,26 @@ class Helpers
/**
* 根据尺寸获得图片url
* @param string $fileName 文件名
* @param string $url 路径
* @param integer $width 图片宽度
* @param integer $height 图片高度
* @param integer $mode 模式
* @return string 图片地址
*/
public static function getImageUrl($fileName, $width, $height, $mode = 2)
public static function getImageUrl($url, $width, $height, $mode = 2)
{
return strtr($fileName, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode));
return strtr($url, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode));
}
/**
* 获取过滤后的URL链接
*
* @param string $url 路径
* @return string 去除掉如&openby:yohobuy={"action":"go.brand"}这样的APP附加参数
*/
public static function getFilterUrl($url)
{
return strstr($url, '&openby:yohobuy=', true);
}
/**
... ...
{{> layout/page_footer}}
{{#if rlsEnv}}
<script src="http://static.wap.yohobuy.com/js/sea.js"></script>
<script>seajs.config({base:'http://static.wap.yohobuy.com/'});</script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
{{/if}}
{{#if testEnv}}
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://localhost:8000/'
});
</script>
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
{{/if}}
{{> layout/use}}
</body>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{title}}YOHO!有货</title>
<meta name="keywords" content="{{keywords}}Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
<meta name="description" content="{{description}}YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function (doc, win) {
var docEl = doc.documentElement;
(function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
{{#if rlsEnv}}
<link rel="stylesheet" href="http://static.wap.yohobuy.com/css/index.css">
{{/if}}
{{#if testEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/myohobuy/{{version}}/index.css">
{{/if}}
{{#if devEnv}}
<link rel="stylesheet" href="http://static.dev.yohobuy.com/css/index.css">
{{/if}}
<meta charset="utf-8">
<title>{{title}}YOHO!有货</title>
<meta name="keywords" content="{{keywords}}Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
<meta name="description" content="{{description}}YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function(doc, win) {
var docEl = doc.documentElement;
(function() {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
{{#if rlsEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/myohobuy/{{version}}/index.css">
{{/if}}
{{#if testEnv}}
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index.css">
{{/if}}
{{#if devEnv}}
<link rel="stylesheet" href="http://static.dev.yohobuy.com/css/index.css">
{{/if}}
</head>
<body {{#if isPassportPage}}class=passport-body{{/if}}>
{{> layout/page_header}}
\ No newline at end of file
{{> layout/page_header}}
\ No newline at end of file
... ...
{{#pageHeader}}
<header class="yoho-header">
{{#navBack}}
<a href={{.}} class="nav-back"></a>
{{/navBack}}
{{#navHome}}
<a href={{.}} class="nav-home"></a>
{{/navHome}}
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
</header>
{{#pageHeader}}
<header class="yoho-header">
{{#if navBack}}
<a href="javascript:history.go(-1);" class="nav-back"></a>
{{/if}}
{{#navHome}}
<a href="{{.}}" class="nav-home"></a>
{{/navHome}}
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
</header>
{{/pageHeader}}
\ No newline at end of file
... ...
<script>
seajs.use('js/common');
</script>
{{!-- 逛(PLUS+STAR) --}}
{{#if psList}}
<script>
seajs.use('js/guang/plus-star/list');
</script>
<script>
seajs.use('js/guang/plus-star/list');
</script>
{{/if}}
{{#if psDetail}}
<script>
seajs.use('js/guang/plus-star/detail');
</script>
<script>
seajs.use('js/guang/plus-star/detail');
</script>
{{/if}}
{{#if guangHome}}
<script>
seajs.use('js/guang/home');
</script>
<script>
seajs.use('js/guang/home');
</script>
{{/if}}
{{#if guangList}}
<script>
seajs.use('js/guang/list');
</script>
<script>
seajs.use('js/guang/list');
</script>
{{/if}}
{{#if guangDetail}}
<script>
seajs.use('js/guang/detail');
</script>
<script>
seajs.use('js/guang/detail');
</script>
{{/if}}
{{!-- 注册 --}}
{{#if regIndex}}
<script>
seajs.use('js/passport/register/register');
</script>
<script>
seajs.use('js/passport/register/register');
</script>
{{/if}}
{{#if regCode}}
<script>
seajs.use('js/passport/register/code');
</script>
<script>
seajs.use('js/passport/register/code');
</script>
{{/if}}
{{#if regPwd}}
<script>
seajs.use('js/passport/register/password');
</script>
<script>
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
seajs.use('js/passport/login/login');
</script>
<script>
seajs.use('js/passport/login/login');
</script>
{{/if}}
{{#if loginInterational}}
<script>
seajs.use('js/passport/login/interational');
</script>
<script>
seajs.use('js/passport/login/interational');
</script>
{{/if}}
{{!-- 密码找回 --}}
{{#if backEmail}}
<script>
seajs.use('js/passport/back/email');
</script>
<script>
seajs.use('js/passport/back/email');
</script>
{{/if}}
{{#if backEmailSuccess}}
<script>
seajs.use('js/passport/back/email-success');
</script>
<script>
seajs.use('js/passport/back/email-success');
</script>
{{/if}}
{{#if backMobile}}
<script>
seajs.use('js/passport/back/mobile');
</script>
<script>
seajs.use('js/passport/back/mobile');
</script>
{{/if}}
{{#if backCode}}
<script>
seajs.use('js/passport/back/code');
</script>
<script>
seajs.use('js/passport/back/code');
</script>
{{/if}}
{{#if backNewPwd}}
<script>
seajs.use('js/passport/back/new-password');
</script>
<script>
seajs.use('js/passport/back/new-password');
</script>
{{/if}}
{{!-- 首页 --}}
{{#if grilsHomePage}}
<script>
seajs.use('js/home/home');
</script>
<script>
seajs.use('js/home/home');
</script>
{{/if}}
{{#if boysHomePage}}
<script>
seajs.use('js/home/home');
</script>
<script>
seajs.use('js/home/home');
</script>
{{/if}}
{{#if kidsHomePage}}
<script>
seajs.use('js/home/home');
</script>
<script>
seajs.use('js/home/home');
</script>
{{/if}}
{{#if lifestyleHomePage}}
<script>
seajs.use('js/home/home');
</script>
<script>
seajs.use('js/home/home');
</script>
{{/if}}
{{!-- 新品到着 --}}
{{#if newArrival}}
<script>
seajs.use('js/product/newsale/newarrival');
</script>
<script>
seajs.use('js/product/newsale/newarrival');
</script>
{{/if}}
{{!-- 折扣专区 --}}
{{#if discount}}
<script>
seajs.use('js/product/newsale/discount');
</script>
<script>
seajs.use('js/product/newsale/discount');
</script>
{{/if}}
{{!-- 商品列表 --}}
{{#if goodListPage}}
<script>
seajs.use('js/product/list');
</script>
<script>
seajs.use('js/product/list');
</script>
{{/if}}
{{!-- 品类 --}}
{{#if categoryPage}}
<script>
seajs.use('js/category/index');
</script>
<script>
seajs.use('js/category/index');
</script>
{{/if}}
{{!-- 品牌 --}}
{{#if brandPage}}
<script>
seajs.use('js/category/brand');
</script>
<script>
seajs.use('js/category/brand');
</script>
{{/if}}
{{!-- 搜索 --}}
{{#if searchPage}}
<script>
seajs.use('js/index/search');
</script>
<script>
seajs.use('js/index/search');
</script>
{{/if}}
{{!-- 购物车 --}}
{{#if shoppingCartPage}}
<script>
seajs.use('js/shopping-cart/index');
</script>
<script>
seajs.use('js/shopping-cart/index');
</script>
{{/if}}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,9 @@ class BoysController extends AbstractAction
*/
public function indexAction()
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
// 设置网站标题
$this->setTitle('男生首页');
// 显示侧边栏
... ...
... ... @@ -13,6 +13,9 @@ class GirlsController extends AbstractAction
*/
public function indexAction()
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS);
// 设置网站标题
$this->setTitle('女生首页');
// 显示侧边栏
... ... @@ -26,7 +29,6 @@ class GirlsController extends AbstractAction
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor()
));
}
}
... ...
... ... @@ -13,6 +13,10 @@ class IndexController extends AbstractAction
*/
public function indexAction()
{
// 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
Index\HomeModel::goSwitchChannel();
// 渲染模板
$this->_view->display('index', array(
'background' => Index\HomeModel::getBgImage()
));
... ...
... ... @@ -13,6 +13,9 @@ class KidsController extends AbstractAction
*/
public function indexAction()
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_KIDS);
// 设置网站标题
$this->setTitle('潮童首页');
// 显示侧边栏
... ... @@ -26,7 +29,6 @@ class KidsController extends AbstractAction
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor()
));
}
}
... ...
... ... @@ -13,6 +13,9 @@ class LifestyleController extends AbstractAction
*/
public function indexAction()
{
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_LIFESTYLE);
// 设置网站标题
$this->setTitle('创意生活首页');
// 显示侧边栏
... ... @@ -26,7 +29,6 @@ class LifestyleController extends AbstractAction
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor()
));
}
}
... ...
<?php
namespace Category;
use LibModels\Wap\Category\BrandData;
use Configs\CacheConfig;
use Plugin\Helpers;
/**
* 品牌相关的模板数据模型
*
* @name BrandModel
* @package Models/Category
* @copyright yoho.inc
* @version 1.0 (2015-10-21 13:52:44)
* @author fei.hong <fei.hong@yoho.cn>
*/
class BrandModel
{
/* 男生频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_BOYS = 'ce6ac059493ec26241a8cbe0bfa1b17a';
/* 女生频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_GIRLS = 'dac99cdedc1f948e84c145aca561f7d2';
/* 潮童频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_KIDS = '713784f93f52bb1a7b93916b2bb15510';
/* 创意生活频道取品牌广告及热门品牌数据的位置码 */
const CODE_TOPPOS_LIFESTYLE = 'f1aa914fd23cbcda71a87de6f5416c75';
/**
* 根据频道获取品牌一览数据
*
* @param int $channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
* @return array
*/
public static function getBrandByChannel($channel)
{
$result = array();
$brand = array();
/* 根据频道调用接口 */
switch (intval($channel)) {
case 1: // 男生
$brand = BrandData::package(self::CODE_TOPPOS_BOYS, 1);
break;
case 2: // 女生
$brand = BrandData::package(self::CODE_TOPPOS_GIRLS, 2);
break;
case 3: // 潮童
$brand = BrandData::package(self::CODE_TOPPOS_KIDS, 3);
break;
case 4: // 创意生活
$brand = BrandData::package(self::CODE_TOPPOS_LIFESTYLE, 4);
break;
}
/* 顶部的轮翻广告列表 */
if (!empty($brand['brandTop'][0]['data'])) {
$build = array();
foreach ($brand['brandTop'][0]['data'] as $value) {
$build['url'] = Helpers::getFilterUrl($value['url']);
$build['img'] = Helpers::getImageUrl($value['src'], 640, 300);
$build['title'] = $value['title'];
$result['bannerTop']['list'][] = $build;
}
}
/* 顶部的热门品牌列表 */
if (!empty($brand['brandTop'][1]['data']['list'])) {
$build = array();
foreach ($brand['brandTop'][1]['data']['list'] as $value) {
$build['url'] = Helpers::getFilterUrl($value['url']);
$build['img'] = Helpers::getImageUrl($value['src'], 144, 144);
$build['name'] = $value['name'];
$result['hotBrand']['list'][] = $build;
}
}
/* 按字母'A-Z'分组的品牌列表 */
if (!empty($brand['brandList']['brands'])) {
$list = array();
$build = array();
foreach ($brand['brandList']['brands'] as $char => $value) {
$build['title'] = $char;
$build['list'] = array();
foreach ($value as $row) {
$list['name'] = $row['brand_name'];
$list['isHot'] = ($row['is_hot'] === 'Y') ? true : false;
$list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false;
$list['url'] = 'http://' . $row['brand_domain'] . '.' . OLD_DOMAIN;
$build['list'][] = $list;
}
$result['brandList'][] = $build;
}
}
$brand = array();
return $result;
}
}
... ...
... ... @@ -19,8 +19,8 @@ use Configs\CacheConfig;
*/
class HomeModel
{
/* 频道选择页取背景图片的位置码 */
const CODE_BG = '7ba9118028f9b22090b57341487567eb';
/* 男生楼层资源的位置码 */
... ... @@ -37,6 +37,44 @@ class HomeModel
/* 女生底部广告的位置码 */
const CODE_BANNER_BOTTOM_GIRLS = '8c8bd1b89a22e5895f05882e0825b493';
/* COOKIE标识访问的是男生频道 */
const COOKIE_NAME_BOYS = 'boys';
/* COOKIE标识访问的是女生频道 */
const COOKIE_NAME_GIRLS = 'girls';
/* COOKIE标识访问的是潮童频道 */
const COOKIE_NAME_KIDS = 'kids';
/* COOKIE标识访问的是创意生活频道 */
const COOKIE_NAME_LIFESTYLE = 'lifestyle';
/**
* 选择频道
*
* @return void
*/
public static function goSwitchChannel()
{
// 通过COOKIE检查是否已设置过首页频道时,跳转到对应的频道页
if (!empty($_COOKIE['_Channel'])) {
headers_sent() || header('Location: /' . $_COOKIE['_Channel']);
exit();
}
// 没有Cookie时, 设置默认访问的频道
else {
self::setSwitchToCookie(self::COOKIE_NAME_BOYS);
}
}
/**
* 设置选择的频道保存到浏览器COOKIE
*
* @param string $cookie
* @return void
*/
public static function setSwitchToCookie($cookie)
{
setcookie('_Channel', $cookie, time() + 86400 * 300, '/', '.' . SITE_DOMAIN);
}
/**
* 获取频道选择页的背景图片
*
... ... @@ -44,6 +82,8 @@ class HomeModel
*/
public static function getBgImage()
{
$result = false;
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_INDEX_INDEX, 'master');
... ... @@ -56,8 +96,6 @@ class HomeModel
$banner = IndexData::getBannerStart(self::CODE_BG);
if (isset($banner['data'][0]['data']['list'][0]['src'])) {
$result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 1);
} else {
$result = false;
}
if (USE_CACHE) {
... ... @@ -76,9 +114,13 @@ class HomeModel
/**
* 获取男生首页的楼层数据
*
* @return array | false
*/
public static function getBoysFloor()
{
$result = array();
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'master');
... ... @@ -103,15 +145,19 @@ class HomeModel
Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result);
}
}
return $result;
}
/**
* 获取女生首页的楼层数据
*
* @return array | false
*/
public static function getGirlsFloor()
{
$result = array();
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_GIRLS_INDEX, 'master');
... ... @@ -136,15 +182,19 @@ class HomeModel
Cache::set(CacheConfig::KEY_ACTION_GIRLS_INDEX, $result);
}
}
return $result;
}
/**
* 获取潮童首页的楼层数据
*
* @return array | false
*/
public static function getKidsFloor()
{
$result = false;
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_KIDS_INDEX, 'master');
... ... @@ -169,15 +219,19 @@ class HomeModel
Cache::set(CacheConfig::KEY_ACTION_KIDS_INDEX, $result);
}
}
return $result;
}
/**
* 获取创意生活首页的楼层数据
*
* @return array | false
*/
public static function getLifestyleFloor()
{
$result = false;
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, 'master');
... ... @@ -202,7 +256,7 @@ class HomeModel
Cache::set(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, $result);
}
}
return $result;
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Category\BrandData;
/**
* 品牌
* 品牌相关的控制器
*/
class BrandController extends AbstractAction
{
/**
* 品牌一览
*
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
public function indexAction()
{
// 获取品牌数据
/*$brandTopData = BrandData::getBrandTopData();
$brandsData = BrandData::getBrandsData();
$this->setTitle('品牌一览');
$this->setNavHeader('品牌一览');
/* 判断参数是否有效 */
$channel = $this->get('channel', 1);
if (!is_numeric($channel) || intval($channel) > 4) {
$channel = 1;
}
/* 获取渲染模板需要的数据 */
$data = Category\BrandModel::getBrandByChannel($channel);
if (!is_array($data)) {
$data = array();
}
$data['brandPage'] = true;
$brandTop = array();
if($brandTopData['code'] == 200)
{
$brandTop = $brandTopData['data'];
}
$brands = array();
if($brandsData['code'] == 200)
{
$brands = $brandsData['data'];
}
echo '<pre>';
var_dump($brandTop, $brands);exit;*/
$data = array (
'brandPage' => true,
'bannerTop' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img10.static.yhbimg.com/adpic/2015/10/15/10/01c161398d3baec2868abe85e26ba1a71d.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/027c45cdc03e23c367ec0ff3d29b7c3f79.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
)
)
),
'hotBrand' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/08/12/17/0233d54f34d2534c08271a8fc27090a6af.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/020b17265b2103b49005c57395b8b154a9.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/11/27/09/02b403bdcbfb965bdc632fea5c29816746.png?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2013/11/01/14/027e68260ba30c01b165c17fe043f2ce2c.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img11.static.yhbimg.com/brandLogo/2014/04/25/14/0179fa8eacf51fd1a89ec6f7fdeab88fc2.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/02608437f8d8b6b7b15786214b0a5ef502.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2013/02/28/17/020aae69720d683a7962c9b7fd3a92c801.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
)
)
),
'brandList' => array (
array (
'title' => '0~9',
'list' => array(
array (
'name' => '004',
'isHot' => true
),
array (
'name' => '10*1',
'isNew' => true
),
array (
'name' => '2%'
)
)
),
array (
'title' => 'A',
'list' => array(
array (
'name' => 'Aape',
'isHot' => true
),
array (
'name' => 'Adfdfd',
'isNew' => true
),
array (
'name' => 'Acrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
)
)
);
$this->_view->assign('title', 'YOHO!有货');
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@
use Yaf\Application;
define('SITE_DOMAIN', 'm.dev.yohobuy.com'); // 网站主域名
define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名
define('USE_CACHE', false); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
... ...
... ... @@ -2,6 +2,7 @@
use Yaf\Application;
define('SITE_DOMAIN', 'buy.test.yoho.cn'); // 网站主域名
define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名
define('USE_CACHE', true); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
... ...
... ... @@ -2,6 +2,7 @@
use Yaf\Application;
define('SITE_DOMAIN', 'wap.yohobuy.com'); // 网站主域名
define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名
define('USE_CACHE', true); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
... ...