Authored by Rock Zhang

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

Conflicts:
	library/Plugin/DataProcess/ListProcess.php
... ... @@ -22,7 +22,7 @@
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.css">
</head>
<body class=passport-body>
<div class="back-email-page passport-page yoho-page">
... ... @@ -36,8 +36,8 @@
<span id="btn-sure" class="btn btn-sure disable row">确定</span>
</div>
</div>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.js"></script>
<script>
seajs.use('js/common');
</script>
... ...
... ... @@ -22,7 +22,7 @@
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.css">
</head>
<body class=passport-body>
<div class="login-international-page passport-page yoho-page">
... ... @@ -57,8 +57,8 @@
<span id="btn-login" class="btn btn-login disble row">登录</span>
</div>
</div>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.js"></script>
<script>
seajs.use('js/common');
</script>
... ...
... ... @@ -22,7 +22,7 @@
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.css">
</head>
<body class=passport-body>
<div class="back-mobile-page passport-page yoho-page">
... ... @@ -54,8 +54,8 @@
<span id="btn-next" class="btn btn-next disable row">下一步</span>
</div>
</div>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.js"></script>
<script>
seajs.use('js/common');
</script>
... ...
... ... @@ -22,7 +22,7 @@
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.css">
</head>
<body class=passport-body>
<div class="reg-page passport-page yoho-page">
... ... @@ -55,8 +55,8 @@
<p class="register-tip">YOHO!Family账号可登录YOHO!有货、YOHO!Boys、YOHO!Girls及SHOW</p>
</div>
</div>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.js"></script>
<script>
seajs.use('js/common');
</script>
... ...
... ... @@ -22,7 +22,7 @@
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.css">
</head>
<body class=passport-body>
<div class="login-page passport-page yoho-page">
... ... @@ -69,8 +69,8 @@
</ul>
</div>
</div>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.6/index.js"></script>
<script>
seajs.use('js/common');
</script>
... ...
... ... @@ -112,7 +112,7 @@ class NewsaleData
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
return Yohobuy::get(Yohobuy::API_URL, $param, 600); // 缓存10分钟
}
/**
... ...
<?php
namespace Plugin\DataProcess;
use Plugin\Helpers;
/**
... ... @@ -17,19 +18,16 @@ class ListProcess
*/
public static function getListData($data)
{
$result = array('new'=>array(), 'filter'=>array());
$result = array('new' => array(), 'filter' => array());
if(isset($data['product_list']))
{
if (isset($data['product_list'])) {
$result['new'] = self::getProductData($data['product_list']);
}
if(isset($data['filter']))
{
if (isset($data['filter'])) {
$result['filter'] = self::getFilterData($data['filter']);
}
return $result;
}
/**
... ... @@ -43,13 +41,11 @@ class ListProcess
// 处理商品
$products = array();
foreach ($data as $value)
{
foreach ($data as $value) {
$products[] = Helpers::formatProduct($value, true, true, true, true);
}
return $products;
}
/**
... ... @@ -62,12 +58,12 @@ class ListProcess
public static function getFilterData($data, $gender = 0)
{
// 过滤条件数据
$filters = array('classify'=>array());
$filters = array('classify' => array());
$num = 1;
$build = array();
foreach ($data as $key => $val) {
if(empty($val))
{
if (empty($val)) {
continue;
}
if (!is_callable("self::$key")) {
... ... @@ -79,7 +75,7 @@ class ListProcess
$build['active'] = true;
}
$num++;
$num ++;
$filters['classify'][] = $build;
}
... ... @@ -87,7 +83,6 @@ class ListProcess
self::sortArrByField($filters['classify'], 'sort_col');
return $filters;
}
private static function brand($data)
... ... @@ -166,7 +161,7 @@ class ListProcess
foreach ($data as $key => $one) {
$discount = array();
$discount['dataId'] = $key;
$discount['name'] = $one['name'] .'折商品';
$discount['name'] = $one['name'] . '折商品';
$result['subs'][] = $discount;
}
... ... @@ -226,18 +221,18 @@ class ListProcess
$category['dataId'] = isset($one['relation_parameter']) ? $one['relation_parameter']['sort'] : 0;
$category['name'] = $one['category_name'];
/*// 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
/* // 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
$category['subs'][] = $subitem;
}
}*/
$category['subs'][] = $subitem;
}
} */
$result['subs'][] = $category;
}
... ... @@ -290,7 +285,7 @@ class ListProcess
foreach ($data as $one) {
$size = array();
$size['dataId'] = $one['size_id'];
$size['dataId'] = $one['size_id'];
$size['name'] = $one['size_name'];
$result['subs'][] = $size;
... ... @@ -306,7 +301,8 @@ class ListProcess
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private static function sortArrByField(&$array, $field, $desc = false){
private static function sortArrByField(&$array, $field, $desc = false)
{
$fieldArr = array();
foreach ($array as $k => $v) {
$fieldArr[$k] = $v[$field];
... ... @@ -314,4 +310,5 @@ class ListProcess
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array);
}
}
... ...
... ... @@ -43,8 +43,7 @@ class NewSaleProcess
// 处理商品
if (isset($products['product_list'])) {
foreach ($products['product_list'] as $single) {
$result['goods'][] = Helpers::formatProduct($single, true, false, false);
$result['goods'][] = Helpers::formatProduct($single, true, false, false, 290, 388);
}
}
... ...
... ... @@ -204,7 +204,7 @@ class Helpers
$result['price'] = $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
$result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_'
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
. $productData['goods_list'][0]['goods_id']
. '/' . $productData['cn_alphabet'] . '.html';
... ...
... ... @@ -201,6 +201,14 @@ server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /plustar {
proxy_redirect off;
proxy_pass http://yohobuy;
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 ^~ /search {
... ... @@ -211,6 +219,14 @@ server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /index/search {
proxy_redirect off;
proxy_pass http://yohobuy;
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 / {
... ...
... ... @@ -10,7 +10,7 @@
<div class="trend-coll-tail">
<h3 class="recommend-title">推荐搭配</h3>
<div class="recommend-swiper">
<ul class="recommend-list clearfix">
<ul class="recommend-list swiper-wrapper clearfix">
{{# recommend_collocation}}
<li class="recommend-item swiper-slide"><a href="{{url}}"><img class="img" src="{{img}}" alt="" /></a></li>
{{/ recommend_collocation}}
... ...
... ... @@ -149,6 +149,9 @@ class SearchController extends AbstractAction
$this->setTitle('搜索');
$this->setNavHeader('搜索', true, SITE_MAIN);
}
// 右下角的购物车链接
$data['goodList']['cartUrl'] = Helpers::url('/cart/index/index', null);
// // 查询数据
// if (!isset($condition['query'])) {
... ...
... ... @@ -46,7 +46,6 @@ class NewsaleModel
switch (intval($channel)) {
case 1: // 男生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS, self::CODE_TOP_NEW_BOYS);
break;
case 2: // 女生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_GIRLS, self::CODE_TOP_NEW_GIRLS);
... ... @@ -214,7 +213,7 @@ class NewsaleModel
if (isset($data['code']) && $data['code'] === 200) {
foreach ($data['data']['product_list'] as $val) {
$result['goods'][] = Helpers::formatProduct($val, true, false, false);
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388);
}
}
... ...
... ... @@ -25,7 +25,7 @@ class ClassController extends AbstractAction
'showDownloadApp' => true,
'category' => array(
'class' => $classes,
'searchUrl' => Helpers::url('/search.html', null, 'search'),
'searchUrl' => Helpers::url('/search', null, 'search'),
)
);
... ...
... ... @@ -51,6 +51,10 @@ class IndexController extends AbstractAction
$this->setTitle($name);
$this->setNavHeader($name, true, SITE_MAIN);
$goodList = array();
$goodList['cartUrl'] = Helpers::url('/cart/index/index', null);
$goodList += $condition;
// $goodList = Product\ListModel::getClassData($condition);
// if (!empty($condition) && !empty($goodList)) {
// $goodList = array_merge($goodList, $condition);
... ... @@ -58,8 +62,8 @@ class IndexController extends AbstractAction
$this->_view->display('index', array(
'goodListPage' => true,
'showDownloadApp' => true,
'goodList' => $condition,
'pageFooter' => true,
'goodList' => $goodList,
'pageFooter' => true,
));
}
... ... @@ -84,8 +88,9 @@ class IndexController extends AbstractAction
/* 通过品牌域名找到对应的品牌ID */
$domainList = Product\ListModel::getAllBrandDomains();
$brandIds = array_keys($domainList, $domain);
if (!isset($brandIds[0])) {
$this->go(SITE_MAIN);
$brandId = 0;
if (isset($brandIds[0])) {
$brandId = $brandIds[0];
}
// 当前的登录用户UID
... ... @@ -108,8 +113,8 @@ class IndexController extends AbstractAction
'discount' => FILTER_VALIDATE_INT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
$condition['brand'] = $brandIds[0];
$condition['brand'] = $brandId;
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
... ... @@ -120,15 +125,18 @@ class IndexController extends AbstractAction
// 从搜索页过来的,显示搜索框, 和进入品牌引导信息
if ($from === 'search') {
$data['goodList'] = array();
$data['goodList']['brandWay'] = \Product\ListModel::getBrandLogoByIds($brandIds[0], $title);
$data['goodList']['brandWay'] = \Product\ListModel::getBrandLogoByIds($brandId, $title);
$data['goodList']['search']['default'] = $query;
$data['goodList']['search']['url'] = Helpers::url('', null, 'search');
}
// 品牌一览过来的展示品牌介绍和LOGO
else {
$data['brandHome'] = \Product\ListModel::getBrandIntro($brandIds[0], $uid, $title);
$data['brandHome'] = \Product\ListModel::getBrandIntro($brandId, $uid, $title);
$data['goodList'] = array();
}
// 右下角的购物车链接
$data['goodList']['cartUrl'] = Helpers::url('/cart/index/index', null);
$data['goodList'] += $condition;
$data['pageFooter'] = true;
... ...
... ... @@ -33,7 +33,8 @@ class NewsaleController extends AbstractAction
'price' => '0',
'size' => '0',
'dayLimit' => 1,
'discount' => ''
'discount' => '',
'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)),
);
$this->_view->display('new', $data);
... ... @@ -61,7 +62,8 @@ class NewsaleController extends AbstractAction
'gender' => Helpers::getGenderByCookie(),
'price' => '0',
'size' => '0',
'discount' => '0.1,0.9'
'discount' => '0.1,0.9',
'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)),
);
$this->_view->display('sale', $data);
... ... @@ -97,7 +99,7 @@ class NewsaleController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::selectData($data);
}
... ...
... ... @@ -63,17 +63,17 @@ routes.cate.route.action = Index
; 品牌一览
routes.brands.type = "rewrite"
routes.brands.match = "/brands"
routes.brands.match = "/brands$"
routes.brands.route.module = Category
routes.brands.route.controller = Brand
routes.brands.route.action = Index
; 品牌一览搜索页
routes.brands.type = "rewrite"
routes.brands.match = "/brands/search"
routes.brands.route.module = Category
routes.brands.route.controller = Brand
routes.brands.route.action = Search
routes.brandsearch.type = "rewrite"
routes.brandsearch.match = "/brands/search"
routes.brandsearch.route.module = Category
routes.brandsearch.route.controller = Brand
routes.brandsearch.route.action = Search
; 新品到着(NEW)
routes.productnew.type = "rewrite"
... ... @@ -104,10 +104,10 @@ routes.goodsfilter.route.controller = Search
routes.goodsfilter.route.action = Filter
; 品牌搜索
routes.productnew.type = "rewrite"
routes.productnew.match = "/brands/search$"
routes.productnew.route.module = Category
routes.productnew.route.controller = Brand
routes.productnew.route.action = Search
routes.brandsearch.type = "rewrite"
routes.brandsearch.match = "/brands/search$"
routes.brandsearch.route.module = Category
routes.brandsearch.route.controller = Brand
routes.brandsearch.route.action = Search
... ...