Authored by hf

run gulp ge to gzip css js

@@ -59,7 +59,7 @@ class Helpers @@ -59,7 +59,7 @@ class Helpers
59 */ 59 */
60 public static function getFilterUrl($url) 60 public static function getFilterUrl($url)
61 { 61 {
62 - $filter = strtr(strstr($url, 'openby:yohobuy=', true), array('m.yohobuy.com' => SUB_DOMAIN)); 62 + $filter = strtr(strstr($url, 'openby:yohobuy=', true), array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN));
63 if ($filter) { 63 if ($filter) {
64 return rtrim(rtrim($filter, '?'), '&'); 64 return rtrim(rtrim($filter, '?'), '&');
65 } else { 65 } else {
@@ -84,6 +84,28 @@ class Helpers @@ -84,6 +84,28 @@ class Helpers
84 return '1,2,3'; 84 return '1,2,3';
85 } 85 }
86 } 86 }
  87 +
  88 + /**
  89 + * 根据用户访问的COOKIE判断出频道
  90 + *
  91 + * @return int
  92 + */
  93 + public static function getChannelByCookie()
  94 + {
  95 + $cookie = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
  96 + switch (strval($cookie)) {
  97 + case 'boys': // 男
  98 + return 1;
  99 + case 'girls': // 女
  100 + return 2;
  101 + case 'kids': // 潮童
  102 + return 3;
  103 + case 'lifestyle': // 创意生活
  104 + return 4;
  105 + default: // 其它
  106 + return 1;
  107 + }
  108 + }
87 109
88 /** 110 /**
89 * 格式化商品信息 111 * 格式化商品信息
1 { 1 {
2 "name": "yohobuy", 2 "name": "yohobuy",
3 - "version": "0.0.1", 3 + "version": "0.0.2",
4 "description": "yohobuy statics", 4 "description": "yohobuy statics",
5 "keywords": [], 5 "keywords": [],
6 "homepage": "", 6 "homepage": "",
@@ -63,7 +63,10 @@ class ClassModel @@ -63,7 +63,10 @@ class ClassModel
63 $subitem = array(); 63 $subitem = array();
64 $subitem['name'] = $value['category_name']; 64 $subitem['name'] = $value['category_name'];
65 $subitem['id'] = $value['relation_parameter']['sort']; 65 $subitem['id'] = $value['relation_parameter']['sort'];
66 - $subitem['url'] = '/product/list/class?sort=' . $value['relation_parameter']['sort']; 66 + $subitem['url'] = Helpers::url('/', array(
  67 + 'sort' => $value['relation_parameter']['sort'],
  68 + 'sort_name' => $value['category_name']
  69 + ), 'list');
67 70
68 $item['sub'][] = $subitem; 71 $item['sub'][] = $subitem;
69 } 72 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\Wap\Product\NewsaleData; 4 use LibModels\Wap\Product\NewsaleData;
5 use Product\NewsaleModel; 5 use Product\NewsaleModel;
  6 +use Plugin\Helpers;
6 7
7 /** 8 /**
8 * 新品到着 9 * 新品到着
@@ -20,8 +21,7 @@ class NewsaleController extends AbstractAction @@ -20,8 +21,7 @@ class NewsaleController extends AbstractAction
20 $this->setTitle('新品到着'); 21 $this->setTitle('新品到着');
21 $this->setNavHeader('新品到着'); 22 $this->setNavHeader('新品到着');
22 23
23 - $channel = $this->getCookie('_Channel', 'boys');  
24 - $this->channelTrans($channel); 24 + $channel = Helpers::getChannelByCookie();
25 25
26 $data = array(); 26 $data = array();
27 $data['newArrivalPage'] = true; 27 $data['newArrivalPage'] = true;
@@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction @@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction
34 $data += array( 34 $data += array(
35 'brand' => 0, 35 'brand' => 0,
36 'msort' => 0, 36 'msort' => 0,
37 - 'gender' => $this->getCookie('_Channel', 'boys'), 37 + 'gender' => Helpers::getGenderByCookie(),
38 'price' => 0, 38 'price' => 0,
39 'size' => 0, 39 'size' => 0,
40 'dayLimit' => 1, 40 'dayLimit' => 1,
@@ -54,9 +54,8 @@ class NewsaleController extends AbstractAction @@ -54,9 +54,8 @@ class NewsaleController extends AbstractAction
54 $this->setTitle('折扣专区'); 54 $this->setTitle('折扣专区');
55 $this->setNavHeader('Sale'); 55 $this->setNavHeader('Sale');
56 56
57 - $channel = $this->getCookie('_Channel', 'boys');  
58 - $this->channelTrans($channel);  
59 - 57 + $channel = Helpers::getChannelByCookie();
  58 +
60 $data = array(); 59 $data = array();
61 $data['discountPage'] = true; 60 $data['discountPage'] = true;
62 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); 61 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
@@ -68,7 +67,7 @@ class NewsaleController extends AbstractAction @@ -68,7 +67,7 @@ class NewsaleController extends AbstractAction
68 $data += array( 67 $data += array(
69 'brand' => 0, 68 'brand' => 0,
70 'msort' => 0, 69 'msort' => 0,
71 - 'gender' => $this->getCookie('_Channel', 'boys'), 70 + 'gender' => Helpers::getGenderByCookie(),
72 'price' => 0, 71 'price' => 0,
73 'size' => 0, 72 'size' => 0,
74 'discount' => '0.1,0.9' 73 'discount' => '0.1,0.9'
@@ -92,7 +91,6 @@ class NewsaleController extends AbstractAction @@ -92,7 +91,6 @@ class NewsaleController extends AbstractAction
92 $size = $this->get('size', null); 91 $size = $this->get('size', null);
93 $price = $this->get('price', null); 92 $price = $this->get('price', null);
94 $p_d = $this->get('discount', null); 93 $p_d = $this->get('discount', null);
95 - $channel = $this->getCookie('_Channel', 'boys');  
96 $dayLimit = $this->get('dayLimit', null); 94 $dayLimit = $this->get('dayLimit', null);
97 $limit = $this->get('limit', 60); 95 $limit = $this->get('limit', 60);
98 $page = $this->get('page', 1); 96 $page = $this->get('page', 1);
@@ -128,7 +126,7 @@ class NewsaleController extends AbstractAction @@ -128,7 +126,7 @@ class NewsaleController extends AbstractAction
128 } 126 }
129 127
130 // 转换频道 128 // 转换频道
131 - $this->channelTrans($channel); 129 + $channel = Helpers::getChannelByCookie();
132 130
133 $data = NewsaleData::selectNewSaleProducts( 131 $data = NewsaleData::selectNewSaleProducts(
134 $gender, $brand, $sort, $color, 132 $gender, $brand, $sort, $color,
@@ -149,28 +147,4 @@ class NewsaleController extends AbstractAction @@ -149,28 +147,4 @@ class NewsaleController extends AbstractAction
149 } 147 }
150 } 148 }
151 149
152 - /**  
153 - * 转换频道  
154 - * @param string &$channel 待转换的频道  
155 - * @return integer 转换之后的频道  
156 - */  
157 - private function channelTrans(&$channel)  
158 - {  
159 - switch ($channel) {  
160 - case 'girls':  
161 - $channel = 2;  
162 - break;  
163 - case 'kids':  
164 - $channel = 3;  
165 - break;  
166 - case 'lifestyle':  
167 - $channel = 4;  
168 - break;  
169 - case 'boys':  
170 - default:  
171 - $channel = 1;  
172 - break;  
173 - }  
174 - }  
175 -  
176 } 150 }
@@ -50,4 +50,4 @@ application.template.ext = ".phtml" @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.1"  
  53 +application.version = "0.0.2"
@@ -50,4 +50,4 @@ application.template.ext = ".phtml" @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.1"  
  53 +application.version = "0.0.2"
@@ -50,4 +50,4 @@ application.template.ext = ".phtml" @@ -50,4 +50,4 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.1"  
  53 +application.version = "0.0.2"
@@ -68,4 +68,18 @@ routes.brands.route.module = Category @@ -68,4 +68,18 @@ routes.brands.route.module = Category
68 routes.brands.route.controller = Brand 68 routes.brands.route.controller = Brand
69 routes.brands.route.action = Index 69 routes.brands.route.action = Index
70 70
  71 +; 新品到着(NEW)
  72 +routes.productnew.type = "rewrite"
  73 +routes.productnew.match = "/product/new"
  74 +routes.productnew.route.module = Product
  75 +routes.productnew.route.controller = Newsale
  76 +routes.productnew.route.action = Index
  77 +
  78 +; 折扣专区(SALE)
  79 +routes.productsale.type = "rewrite"
  80 +routes.productsale.match = "/sale"
  81 +routes.productsale.route.module = Product
  82 +routes.productsale.route.controller = Newsale
  83 +routes.productsale.route.action = Discount
  84 +
71 85