Authored by hf

run gulp ge to gzip css js

... ... @@ -59,7 +59,7 @@ class Helpers
*/
public static function getFilterUrl($url)
{
$filter = strtr(strstr($url, 'openby:yohobuy=', true), array('m.yohobuy.com' => SUB_DOMAIN));
$filter = strtr(strstr($url, 'openby:yohobuy=', true), array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN));
if ($filter) {
return rtrim(rtrim($filter, '?'), '&');
} else {
... ... @@ -84,6 +84,28 @@ class Helpers
return '1,2,3';
}
}
/**
* 根据用户访问的COOKIE判断出频道
*
* @return int
*/
public static function getChannelByCookie()
{
$cookie = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
switch (strval($cookie)) {
case 'boys': // 男
return 1;
case 'girls': // 女
return 2;
case 'kids': // 潮童
return 3;
case 'lifestyle': // 创意生活
return 4;
default: // 其它
return 1;
}
}
/**
* 格式化商品信息
... ...
{
"name": "yohobuy",
"version": "0.0.1",
"version": "0.0.2",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -63,7 +63,10 @@ class ClassModel
$subitem = array();
$subitem['name'] = $value['category_name'];
$subitem['id'] = $value['relation_parameter']['sort'];
$subitem['url'] = '/product/list/class?sort=' . $value['relation_parameter']['sort'];
$subitem['url'] = Helpers::url('/', array(
'sort' => $value['relation_parameter']['sort'],
'sort_name' => $value['category_name']
), 'list');
$item['sub'][] = $subitem;
}
... ...
... ... @@ -3,6 +3,7 @@
use Action\AbstractAction;
use LibModels\Wap\Product\NewsaleData;
use Product\NewsaleModel;
use Plugin\Helpers;
/**
* 新品到着
... ... @@ -20,8 +21,7 @@ class NewsaleController extends AbstractAction
$this->setTitle('新品到着');
$this->setNavHeader('新品到着');
$channel = $this->getCookie('_Channel', 'boys');
$this->channelTrans($channel);
$channel = Helpers::getChannelByCookie();
$data = array();
$data['newArrivalPage'] = true;
... ... @@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction
$data += array(
'brand' => 0,
'msort' => 0,
'gender' => $this->getCookie('_Channel', 'boys'),
'gender' => Helpers::getGenderByCookie(),
'price' => 0,
'size' => 0,
'dayLimit' => 1,
... ... @@ -54,9 +54,8 @@ class NewsaleController extends AbstractAction
$this->setTitle('折扣专区');
$this->setNavHeader('Sale');
$channel = $this->getCookie('_Channel', 'boys');
$this->channelTrans($channel);
$channel = Helpers::getChannelByCookie();
$data = array();
$data['discountPage'] = true;
$data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
... ... @@ -68,7 +67,7 @@ class NewsaleController extends AbstractAction
$data += array(
'brand' => 0,
'msort' => 0,
'gender' => $this->getCookie('_Channel', 'boys'),
'gender' => Helpers::getGenderByCookie(),
'price' => 0,
'size' => 0,
'discount' => '0.1,0.9'
... ... @@ -92,7 +91,6 @@ class NewsaleController extends AbstractAction
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('discount', null);
$channel = $this->getCookie('_Channel', 'boys');
$dayLimit = $this->get('dayLimit', null);
$limit = $this->get('limit', 60);
$page = $this->get('page', 1);
... ... @@ -128,7 +126,7 @@ class NewsaleController extends AbstractAction
}
// 转换频道
$this->channelTrans($channel);
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color,
... ... @@ -149,28 +147,4 @@ class NewsaleController extends AbstractAction
}
}
/**
* 转换频道
* @param string &$channel 待转换的频道
* @return integer 转换之后的频道
*/
private function channelTrans(&$channel)
{
switch ($channel) {
case 'girls':
$channel = 2;
break;
case 'kids':
$channel = 3;
break;
case 'lifestyle':
$channel = 4;
break;
case 'boys':
default:
$channel = 1;
break;
}
}
}
... ...
... ... @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
application.version = "0.0.2"
\ No newline at end of file
... ...
... ... @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
application.version = "0.0.2"
\ No newline at end of file
... ...
... ... @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
application.version = "0.0.2"
\ No newline at end of file
... ...
... ... @@ -68,4 +68,18 @@ routes.brands.route.module = Category
routes.brands.route.controller = Brand
routes.brands.route.action = Index
; 新品到着(NEW)
routes.productnew.type = "rewrite"
routes.productnew.match = "/product/new"
routes.productnew.route.module = Product
routes.productnew.route.controller = Newsale
routes.productnew.route.action = Index
; 折扣专区(SALE)
routes.productsale.type = "rewrite"
routes.productsale.match = "/sale"
routes.productsale.route.module = Product
routes.productsale.route.controller = Newsale
routes.productsale.route.action = Discount
... ...