Authored by hf

fixes bug refs YW-933

... ... @@ -175,9 +175,11 @@ class Helpers
* @param bool $showTag 控制是否显示标签
* @param bool $showNew 控制是否显示NEW图标
* @param bool $showSale 控制是否显示SALE图标
* @param int $width 图片的宽度
* @param int $height 图片的高度
* @return array | false
*/
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true)
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388)
{
// 商品信息有问题,则不显示
if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
... ... @@ -197,7 +199,7 @@ class Helpers
$result = array();
$result['id'] = $productData['product_skn'];
$result['product_id'] = $productData['product_id'];
$result['thumb'] = Images::getImageUrl($productData['default_images'], 235, 314);
$result['thumb'] = Images::getImageUrl($productData['default_images'], $width, $height);
$result['name'] = $productData['product_name'];
$result['price'] = $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
... ...
... ... @@ -17,33 +17,71 @@ server
allow 172.16.0.0/16;
deny all;
# 子域名
if ($host = "sale.test.yoho.cn" ) {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.162;
proxy_set_header Host cuxiao.m.yohobuy.com;
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";
}
if ($host = "cuxiao.test.yoho.cn" ) {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://101.201.176.121;
proxy_set_header Host cuxiao.m.yohobuy.com;
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 =/signin.html {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
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 /passport/auth {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
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 /passport/signin {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
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 /home {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
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 /cart {
rewrite ^/(.*)$ http://m.yohobuy.com/$1 permanent;
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
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 ~* \.html$ {
... ...
... ... @@ -122,6 +122,8 @@ class SearchController extends AbstractAction
} while (false);
$classNames = array();
} else {
$condition['query'] = '';
}
$data = array();
... ...
... ... @@ -99,7 +99,7 @@ class InfoController extends AbstractAction
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false);
$good[] = Helpers::formatProduct($goods, false, true, true, 235,314);
}
}
// 没有商品
... ... @@ -130,7 +130,7 @@ class InfoController extends AbstractAction
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
$good['goods'][] = Helpers::formatProduct($goods, false);
$good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235,314);
}
$build['collocation'][] = $good;
}
... ...
... ... @@ -56,7 +56,7 @@ class RecomController extends AbstractAction
/* 构建商品数据 */
$data = array();
foreach ($recom['data']['product_list'] as $value) {
$data['goods'][] = Helpers::formatProduct($value, true);
$data['goods'][] = Helpers::formatProduct($value, true, true, true, 276, 366);
}
$this->_view->display('maylike', $data);
} while (false);
... ...
... ... @@ -14,7 +14,7 @@ routes.error.route.action = Index
; 搜索页
routes.search.type = "rewrite"
routes.search.match = "/search.html"
routes.search.match = "/(search.html|search)$"
routes.search.route.module = Index
routes.search.route.controller = Search
routes.search.route.action = Index
... ...