Authored by hf

do fixes bug refs YW-783

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -232,10 +232,15 @@ class AbstractAction extends Controller_Abstract @@ -232,10 +232,15 @@ class AbstractAction extends Controller_Abstract
232 protected function getUdid() 232 protected function getUdid()
233 { 233 {
234 $udid = ''; 234 $udid = '';
235 - $ip = $this->_request->getServer('REMOTE_ADDR');  
236 - if ($ip) {  
237 - $udid = ip2long($ip); 235 +
  236 + $realIP = $this->_request->getServer('HTTP_X_REAL_IP');
  237 + if ($realIP) {
  238 + $udid = md5($realIP);
  239 + } else {
  240 + $realIP = $this->_request->getServer('REMOTE_ADDR', '');
  241 + $udid = md5($realIP);
238 } 242 }
  243 +
239 return $udid; 244 return $udid;
240 } 245 }
241 246
@@ -354,70 +359,6 @@ class AbstractAction extends Controller_Abstract @@ -354,70 +359,6 @@ class AbstractAction extends Controller_Abstract
354 protected function setNavSide($guangChoosed = 'all') 359 protected function setNavSide($guangChoosed = 'all')
355 { 360 {
356 $this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed)); 361 $this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed));
357 - /*  
358 - $this->_view->assign('sideNav', array(  
359 - 0 => array(  
360 - 'textCn' => '男生',  
361 - 'textEn' => 'BOYS',  
362 - 'styleClass' => 'boys',  
363 - 'url' => '/boys',  
364 - ),  
365 - 1 => array(  
366 - 'textCn' => '女生',  
367 - 'textEn' => 'GIRLS',  
368 - 'styleClass' => 'girls',  
369 - 'url' => '/girls',  
370 - ),  
371 - 2 => array(  
372 - 'textCn' => '潮童',  
373 - 'textEn' => 'KIDS',  
374 - 'styleClass' => 'kids',  
375 - 'url' => '/kids',  
376 - ),  
377 - 3 => array(  
378 - 'textCn' => '创意生活',  
379 - 'textEn' => 'LIFE STYLE',  
380 - 'styleClass' => 'life',  
381 - 'url' => '/lifestyle',  
382 - ),  
383 - 4 => array(  
384 - 'textCn' => '逛',  
385 - 'textEn' => 'TRENDFINDER',  
386 - 'styleClass' => 'guang',  
387 - 'subNav' => array(  
388 - 'list' => array(  
389 - 0 => array(  
390 - 'textCn' => '逛',  
391 - 'textEn' => 'TrendFinder',  
392 - 'back' => true,  
393 - 'isSelect' => false,  
394 - ),  
395 - 1 => array(  
396 - 'textCn' => '查看全部',  
397 - 'textEn' => '',  
398 - 'back' => false,  
399 - 'isSelect' => ($guangChoosed === 'all') ? true : false,  
400 - 'url' => '/guang/list/index?gender=1,2,3'  
401 - ),  
402 - 2 => array(  
403 - 'textCn' => '只看男生',  
404 - 'textEn' => 'Boys',  
405 - 'back' => false,  
406 - 'isSelect' => ($guangChoosed === 'boys') ? true : false,  
407 - 'url' => '/guang/list/index?gender=1,3'  
408 - ),  
409 - 3 => array(  
410 - 'textCn' => '只看女生',  
411 - 'textEn' => 'Girls',  
412 - 'back' => false,  
413 - 'isSelect' => ($guangChoosed === 'girls') ? true : false,  
414 - 'url' => '/guang/list/index?gender=2,3',  
415 - ),  
416 - )  
417 - )  
418 - ),  
419 - ));  
420 - */  
421 } 362 }
422 363
423 /** 364 /**
@@ -439,7 +380,7 @@ class AbstractAction extends Controller_Abstract @@ -439,7 +380,7 @@ class AbstractAction extends Controller_Abstract
439 */ 380 */
440 protected function setHomeChannelHeader() 381 protected function setHomeChannelHeader()
441 { 382 {
442 - $header['searchUrl'] = ''; 383 + $header['searchUrl'] = '/search';
443 384
444 $this->_view->assign('homeHeader', $header); 385 $this->_view->assign('homeHeader', $header);
445 } 386 }
@@ -118,7 +118,7 @@ class Yohobuy @@ -118,7 +118,7 @@ class Yohobuy
118 } 118 }
119 119
120 /* 开启缓存的情况 */ 120 /* 开启缓存的情况 */
121 - if ($cache) { 121 + if ($cache && USE_CACHE) {
122 // 先尝试获取一级缓存(master), 有数据则直接返回. 122 // 先尝试获取一级缓存(master), 有数据则直接返回.
123 $result = Cache::get($url, 'master'); 123 $result = Cache::get($url, 'master');
124 if (!empty($result)) { 124 if (!empty($result)) {
@@ -138,7 +138,7 @@ class Yohobuy @@ -138,7 +138,7 @@ class Yohobuy
138 $data = array(); 138 $data = array();
139 139
140 /* 开启缓存的情况 */ 140 /* 开启缓存的情况 */
141 - if ($cache) { 141 + if ($cache && USE_CACHE) {
142 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 142 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
143 if (empty($result)) { 143 if (empty($result)) {
144 $result = Cache::get($url, 'slave'); 144 $result = Cache::get($url, 'slave');
@@ -213,7 +213,7 @@ class Yohobuy @@ -213,7 +213,7 @@ class Yohobuy
213 public static function getMulti($urlList = array(), $options = array(), $cache = false, $timeout = 3) 213 public static function getMulti($urlList = array(), $options = array(), $cache = false, $timeout = 3)
214 { 214 {
215 /* 开启缓存的情况 */ 215 /* 开启缓存的情况 */
216 - if ($cache) { 216 + if ($cache && USE_CACHE) {
217 $key = md5(implode(',', array_values($urlList))); 217 $key = md5(implode(',', array_values($urlList)));
218 // 先尝试获取一级缓存(master), 有数据则直接返回. 218 // 先尝试获取一级缓存(master), 有数据则直接返回.
219 $result = Cache::get($key, 'master'); 219 $result = Cache::get($key, 'master');
@@ -291,7 +291,7 @@ class Yohobuy @@ -291,7 +291,7 @@ class Yohobuy
291 curl_multi_close($mh); 291 curl_multi_close($mh);
292 292
293 /* 开启缓存的情况 */ 293 /* 开启缓存的情况 */
294 - if ($cache) { 294 + if ($cache && USE_CACHE) {
295 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 295 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
296 if (empty($result)) { 296 if (empty($result)) {
297 $result = Cache::get($key, 'slave'); 297 $result = Cache::get($key, 'slave');
@@ -319,7 +319,7 @@ class Yohobuy @@ -319,7 +319,7 @@ class Yohobuy
319 public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000) 319 public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
320 { 320 {
321 /* 开启缓存的情况 */ 321 /* 开启缓存的情况 */
322 - if ($cache) { 322 + if ($cache && USE_CACHE) {
323 $key = self::httpBuildQuery($uri . $method, $parameters); 323 $key = self::httpBuildQuery($uri . $method, $parameters);
324 // 先尝试获取一级缓存(master), 有数据则直接返回. 324 // 先尝试获取一级缓存(master), 有数据则直接返回.
325 $result = Cache::get($key, 'master'); 325 $result = Cache::get($key, 'master');
@@ -340,7 +340,7 @@ class Yohobuy @@ -340,7 +340,7 @@ class Yohobuy
340 } 340 }
341 341
342 /* 开启缓存的情况 */ 342 /* 开启缓存的情况 */
343 - if ($cache) { 343 + if ($cache && USE_CACHE) {
344 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 344 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
345 if (empty($result)) { 345 if (empty($result)) {
346 $result = Cache::get($key, 'slave'); 346 $result = Cache::get($key, 'slave');
@@ -7,6 +7,8 @@ namespace Configs; @@ -7,6 +7,8 @@ namespace Configs;
7 */ 7 */
8 class CacheConfig 8 class CacheConfig
9 { 9 {
  10 + /* 公共的数据缓存 */
  11 + const KEY_COMMON_SIDE_NAV = 'key_common_side_nav'; // 公共的侧边栏
10 12
11 /* 控制器方法中的数据缓存 */ 13 /* 控制器方法中的数据缓存 */
12 const KEY_ACTION_INDEX_INDEX = 'key_action_index_index'; // 频道选择 14 const KEY_ACTION_INDEX_INDEX = 'key_action_index_index'; // 频道选择
@@ -15,6 +17,7 @@ class CacheConfig @@ -15,6 +17,7 @@ class CacheConfig
15 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页 17 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
16 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页 18 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
17 19
18 - const KEY_COMMON_SIDE_NAV = 'key_common_side_nav'; // 公共的侧边栏 20 + const KEY_ACTION_PRODUCT_NEWSALE_INDEX = 'key_action_product_newsale_index'; // 新品到着
  21 + const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT = 'key_action_product_newsale_discount'; // 折扣专区
19 22
20 } 23 }
@@ -33,7 +33,7 @@ class ListData @@ -33,7 +33,7 @@ class ListData
33 $param = Yohobuy::param(); 33 $param = Yohobuy::param();
34 $param['client_secret'] = Sign::getSign($param); 34 $param['client_secret'] = Sign::getSign($param);
35 35
36 - return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_CATEGORY, $param); 36 + return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_CATEGORY, $param, 3600); // 有缓存1小时
37 } 37 }
38 38
39 /** 39 /**
@@ -26,8 +26,6 @@ class ListData @@ -26,8 +26,6 @@ class ListData
26 */ 26 */
27 public static function productInfoBySkns($skns) 27 public static function productInfoBySkns($skns)
28 { 28 {
29 - //return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PRODUCT, 'getLessInfoByProductSkns', array());  
30 -  
31 // 调用搜索接口 29 // 调用搜索接口
32 $param = Yohobuy::param(); 30 $param = Yohobuy::param();
33 $param['method'] = 'app.search.li'; 31 $param['method'] = 'app.search.li';
@@ -36,7 +34,7 @@ class ListData @@ -36,7 +34,7 @@ class ListData
36 $param['order'] = 's_t_desc'; 34 $param['order'] = 's_t_desc';
37 $param['client_secret'] = Sign::getSign($param); 35 $param['client_secret'] = Sign::getSign($param);
38 36
39 - return Yohobuy::get(Yohobuy::API_URL, $param); 37 + return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时
40 } 38 }
41 39
42 /** 40 /**
1 <?php 1 <?php
  2 +
2 namespace LibModels\Wap\Product; 3 namespace LibModels\Wap\Product;
3 4
4 use Api\Yohobuy; 5 use Api\Yohobuy;
@@ -16,180 +17,192 @@ use Api\Sign; @@ -16,180 +17,192 @@ use Api\Sign;
16 class NewsaleData 17 class NewsaleData
17 { 18 {
18 19
19 - /**  
20 - * 获取新品到着,折扣专区焦点图数据  
21 - * @param string $contentCode 内容位置码  
22 - * @return array 新品到着焦点图有关数据  
23 - */  
24 - public static function getNewsaleFocus($contentCode)  
25 - {  
26 - // 构建必传参数  
27 - $param = Yohobuy::param();  
28 -  
29 - $param['content_code'] = $contentCode; 20 + /**
  21 + * 获取新品到着,折扣专区焦点图数据
  22 + * @param string $contentCode 内容位置码
  23 + * @return array 新品到着焦点图有关数据
  24 + */
  25 + public static function getNewsaleFocus($contentCode)
  26 + {
  27 + // 构建必传参数
  28 + $param = Yohobuy::param();
  29 +
  30 + $param['content_code'] = $contentCode;
30 $param['client_secret'] = Sign::getSign($param); 31 $param['client_secret'] = Sign::getSign($param);
31 -  
32 - return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param);  
33 - }  
34 -  
35 - /**  
36 - * 获取新品到着商品数据  
37 - *  
38 - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
39 - * @param string $channel 1表示男, 2表示女  
40 - * @param integer $limit 查询返回的最大限制数, 默认为50  
41 - * @param integer $page 分页第几页, 默认第1页  
42 - * @return array 新品到着商品数据  
43 - */  
44 - public static function getNewProducts($gender, $channel, $limit = 50, $page = 1)  
45 - {  
46 - $param = Yohobuy::param();  
47 - $param['method'] = 'app.search.newProduct';  
48 - $param['gender'] = $gender;  
49 - $param['page'] = $page;  
50 - $param['limit'] = $limit;  
51 - $param['yh_channel'] = $channel;  
52 -  
53 - // 构建url地址列表  
54 - $urlList = array();  
55 - $param['dayLimit'] = 1;  
56 - $param['client_secret'] = Sign::getSign($param);  
57 - $urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
58 - $param['dayLimit'] = 2;  
59 - unset($param['client_secret']);  
60 - $param['client_secret'] = Sign::getSign($param);  
61 - $urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
62 - $param['dayLimit'] = 3;  
63 - unset($param['client_secret']);  
64 - $param['client_secret'] = Sign::getSign($param);  
65 - $urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
66 - //var_dump($urlList);exit;  
67 -  
68 - return Yohobuy::getMulti($urlList);  
69 - }  
70 -  
71 - /**  
72 - * 筛选新品到着、折扣专区商品  
73 - *  
74 - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
75 - * @param integer $brand 品牌Id  
76 - * @param integer $sort 品类Id  
77 - * @param integer $color 颜色Id  
78 - * @param integer $size 尺码Id  
79 - * @param string $price 价格  
80 - * @param string $p_d 折扣 32 +
  33 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
  34 + }
  35 +
  36 + /**
  37 + * 获取新品到着商品数据
  38 + *
  39 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  40 + * @param string $channel 1表示男, 2表示女
  41 + * @param integer $limit 查询返回的最大限制数, 默认为50
  42 + * @param integer $page 分页第几页, 默认第1页
  43 + * @return array 新品到着商品数据
  44 + */
  45 + public static function getNewProducts($gender, $channel, $limit = 50, $page = 1)
  46 + {
  47 + // 构建url地址列表
  48 + $urlList = array();
  49 +
  50 + $param = Yohobuy::param();
  51 + $param['method'] = 'app.search.newProduct';
  52 + $param['gender'] = $gender;
  53 + $param['page'] = $page;
  54 + $param['limit'] = $limit;
  55 + $param['yh_channel'] = $channel;
  56 +
  57 + $build = $param;
  58 + $build['dayLimit'] = 1;
  59 + $build['client_secret'] = Sign::getSign($build);
  60 + $urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
  61 +
  62 + $build = $param;
  63 + $build['dayLimit'] = 2;
  64 + $build['client_secret'] = Sign::getSign($build);
  65 + $urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
  66 +
  67 + $build = $param;
  68 + $build['dayLimit'] = 3;
  69 + $build['client_secret'] = Sign::getSign($build);
  70 + $urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
  71 +
  72 + $build = array();
  73 + $param = array();
  74 +
  75 + return Yohobuy::getMulti($urlList);
  76 + }
  77 +
  78 + /**
  79 + * 筛选新品到着、折扣专区商品
  80 + *
  81 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  82 + * @param integer $brand 品牌Id
  83 + * @param integer $sort 品类Id
  84 + * @param integer $color 颜色Id
  85 + * @param integer $size 尺码Id
  86 + * @param string $price 价格
  87 + * @param string $p_d 折扣
81 * @param integer $channel 表示频道号,1位男生,2为女生 88 * @param integer $channel 表示频道号,1位男生,2为女生
82 - * @param integer $dayLimit 限制读取多少天,默认为1天  
83 - * @param integer $limit 查询返回的最大限制数, 默认为50  
84 - * @param integer $page 分页第几页, 默认第1页  
85 - * @return array 根据指定条件筛选出来的商品  
86 - */  
87 - public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 50, $page = 1)  
88 - {  
89 - $selectItems = array(  
90 - 'gender' => $gender,  
91 - 'brand' => $brand,  
92 - 'sort' => $sort,  
93 - 'color' => $color,  
94 - 'size' => $size,  
95 - 'price' => $price,  
96 - 'p_d' => $p_d,  
97 - 'dayLimit' => $dayLimit  
98 - );  
99 - // 拉取筛选参数  
100 - $queriedParams = array_filter($selectItems, function($v) {return $v !== null;});  
101 -  
102 - $param = Yohobuy::param();  
103 - $param['method'] = 'app.search.newProduct';  
104 - $param['page'] = $page;  
105 - $param['limit'] = $limit;  
106 - $param['yh_channel'] = $channel;  
107 - $param = array_merge($param, $queriedParams);  
108 -  
109 - $param['client_secret'] = Sign::getSign($param);  
110 -  
111 - return Yohobuy::get(Yohobuy::API_URL, $param);  
112 - }  
113 -  
114 -  
115 - /**  
116 - * 获取折扣专区商品数据  
117 - *  
118 - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
119 - * @param string $channel 1表示男, 2表示女  
120 - * @param integer $limit 查询返回的最大限制数, 默认为50  
121 - * @param integer $page 分页第几页, 默认第1页  
122 - * @return array 折扣专区商品数据  
123 - */  
124 - public static function getSaleProducts($gender, $channel, $limit = 60, $page = 1)  
125 - {  
126 - $param = Yohobuy::param();  
127 - $param['method'] = 'app.search.sales';  
128 - $param['gender'] = $gender;  
129 - $param['page'] = $page;  
130 - $param['limit'] = $limit;  
131 - $param['yh_channel'] = $channel;  
132 -  
133 - // 构建url地址列表  
134 - $urlList = array();  
135 - $param['p_d'] = '0.1,0.3';  
136 - $param['client_secret'] = Sign::getSign($param);  
137 - $urlList['1-3折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
138 - $param['p_d'] = '0.4,0.6';  
139 - unset($param['client_secret']);  
140 - $param['client_secret'] = Sign::getSign($param);  
141 - $urlList['4-6折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
142 - $param['p_d'] = '0.7,0.9';  
143 - unset($param['client_secret']);  
144 - $param['client_secret'] = Sign::getSign($param);  
145 - $urlList['7-9折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
146 - $param['p_d'] = '0.1,0.9';  
147 - unset($param['client_secret']);  
148 - $param['client_secret'] = Sign::getSign($param);  
149 - $urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
150 -  
151 - return Yohobuy::getMulti($urlList);  
152 - }  
153 -  
154 - /**  
155 - * 筛选折扣专区商品  
156 - *  
157 - * @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部  
158 - * @param integer brand 品牌Id  
159 - * @param integer sort 品类Id  
160 - * @param integer color 颜色Id  
161 - * @param integer size 尺码Id  
162 - * @param string price 价格  
163 - * @param string $channel 1表示男, 2表示女  
164 - * @param integer $p_d 折扣  
165 - * @param integer $limit 查询返回的最大限制数, 默认为50  
166 - * @param integer $page 分页第几页, 默认第1页  
167 - * @return array 筛选出来的折扣专区商品  
168 - */  
169 - public static function selectSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $limit = 50, $page = 1)  
170 - {  
171 - $selectItems = array(  
172 - 'gender' => $gender,  
173 - 'brand' => $brand,  
174 - 'sort' => $sort,  
175 - 'color' => $color,  
176 - 'size' => $size,  
177 - 'price' => $price  
178 - );  
179 - // 拉取筛选参数  
180 - $queriedParams = array_filter($selectItems, function($v) {return $v !== null;});  
181 -  
182 - $param = Yohobuy::param();  
183 - $param['method'] = 'app.search.sales';  
184 - $param['yh_channel'] = $channel;  
185 - $param['p_d'] = $p_d;  
186 - $param['page'] = $page;  
187 - $param['limit'] = $limit;  
188 - $param = array_merge($param, $queriedParams);  
189 -  
190 - $param['client_secret'] = Sign::getSign($param);  
191 -  
192 - return Yohobuy::get(Yohobuy::API_URL, $param);  
193 - }  
194 - 89 + * @param integer $dayLimit 限制读取多少天,默认为1天
  90 + * @param integer $limit 查询返回的最大限制数, 默认为50
  91 + * @param integer $page 分页第几页, 默认第1页
  92 + * @return array 根据指定条件筛选出来的商品
  93 + */
  94 + public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 50, $page = 1)
  95 + {
  96 + $selectItems = array(
  97 + 'gender' => $gender,
  98 + 'brand' => $brand,
  99 + 'sort' => $sort,
  100 + 'color' => $color,
  101 + 'size' => $size,
  102 + 'price' => $price,
  103 + 'p_d' => $p_d,
  104 + 'dayLimit' => $dayLimit
  105 + );
  106 + // 拉取筛选参数
  107 + $queriedParams = array_filter($selectItems, function($v) {
  108 + return $v !== null;
  109 + });
  110 +
  111 + $param = Yohobuy::param();
  112 + $param['method'] = 'app.search.newProduct';
  113 + $param['page'] = $page;
  114 + $param['limit'] = $limit;
  115 + $param['yh_channel'] = $channel;
  116 + $param = array_merge($param, $queriedParams);
  117 +
  118 + $param['client_secret'] = Sign::getSign($param);
  119 +
  120 + return Yohobuy::get(Yohobuy::API_URL, $param);
  121 + }
  122 +
  123 + /**
  124 + * 获取折扣专区商品数据
  125 + *
  126 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  127 + * @param string $channel 1表示男, 2表示女
  128 + * @param integer $limit 查询返回的最大限制数, 默认为50
  129 + * @param integer $page 分页第几页, 默认第1页
  130 + * @return array 折扣专区商品数据
  131 + */
  132 + public static function getSaleProducts($gender, $channel, $limit = 60, $page = 1)
  133 + {
  134 + $param = Yohobuy::param();
  135 + $param['method'] = 'app.search.sales';
  136 + $param['gender'] = $gender;
  137 + $param['page'] = $page;
  138 + $param['limit'] = $limit;
  139 + $param['yh_channel'] = $channel;
  140 +
  141 + // 构建url地址列表
  142 + $urlList = array();
  143 + $param['p_d'] = '0.1,0.3';
  144 + $param['client_secret'] = Sign::getSign($param);
  145 + $urlList['1-3折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  146 +
  147 + $param['p_d'] = '0.4,0.6';
  148 + unset($param['client_secret']);
  149 + $param['client_secret'] = Sign::getSign($param);
  150 + $urlList['4-6折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  151 +
  152 + $param['p_d'] = '0.7,0.9';
  153 + unset($param['client_secret']);
  154 + $param['client_secret'] = Sign::getSign($param);
  155 + $urlList['7-9折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  156 +
  157 + $param['p_d'] = '0.1,0.9';
  158 + unset($param['client_secret']);
  159 + $param['client_secret'] = Sign::getSign($param);
  160 + $urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  161 +
  162 + return Yohobuy::getMulti($urlList);
  163 + }
  164 +
  165 + /**
  166 + * 筛选折扣专区商品
  167 + *
  168 + * @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  169 + * @param integer brand 品牌Id
  170 + * @param integer sort 品类Id
  171 + * @param integer color 颜色Id
  172 + * @param integer size 尺码Id
  173 + * @param string price 价格
  174 + * @param string $channel 1表示男, 2表示女
  175 + * @param integer $p_d 折扣
  176 + * @param integer $limit 查询返回的最大限制数, 默认为50
  177 + * @param integer $page 分页第几页, 默认第1页
  178 + * @return array 筛选出来的折扣专区商品
  179 + */
  180 + public static function selectSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $limit = 50, $page = 1)
  181 + {
  182 + $selectItems = array(
  183 + 'gender' => $gender,
  184 + 'brand' => $brand,
  185 + 'sort' => $sort,
  186 + 'color' => $color,
  187 + 'size' => $size,
  188 + 'price' => $price
  189 + );
  190 + // 拉取筛选参数
  191 + $queriedParams = array_filter($selectItems, function($v) {
  192 + return $v !== null;
  193 + });
  194 +
  195 + $param = Yohobuy::param();
  196 + $param['method'] = 'app.search.sales';
  197 + $param['yh_channel'] = $channel;
  198 + $param['p_d'] = $p_d;
  199 + $param['page'] = $page;
  200 + $param['limit'] = $limit;
  201 + $param = array_merge($param, $queriedParams);
  202 +
  203 + $param['client_secret'] = Sign::getSign($param);
  204 +
  205 + return Yohobuy::get(Yohobuy::API_URL, $param);
  206 + }
  207 +
195 } 208 }
1 <?php 1 <?php
2 2
3 namespace Plugin\DataProcess; 3 namespace Plugin\DataProcess;
  4 +
4 use Plugin\Helpers; 5 use Plugin\Helpers;
5 6
6 /** 7 /**
@@ -12,29 +13,29 @@ class NewSaleProcess @@ -12,29 +13,29 @@ class NewSaleProcess
12 /** 13 /**
13 * 处理新品到着、折扣专区数据 14 * 处理新品到着、折扣专区数据
14 * 15 *
15 - * @param array $data 接口传回的数据 16 + * @param array $products 接口传回的数据
16 * @return array 处理之后的数据 17 * @return array 处理之后的数据
17 */ 18 */
18 - public static function newSaleData($focus, $products) 19 + public static function newSaleData($products)
19 { 20 {
20 - $result = array(  
21 - 'headerBanner' => self::bannerData($focus),  
22 - 'goodsContainer' => array()  
23 - );  
24 -  
25 - foreach($products as $single)  
26 - { 21 + $result = array();
  22 + $noTab = true;
  23 + $productsLi = array();
  24 + $tabItem = array();
  25 +
  26 + foreach ($products as $single) {
  27 + if (empty($single)) {
  28 + continue;
  29 + }
  30 +
27 // 处理Tabs 31 // 处理Tabs
28 $noTab = true; 32 $noTab = true;
29 - if(isset($single['tabs']) && $noTab)  
30 - { 33 + if (isset($single['tabs']) && $noTab) {
31 $result['tabs'] = array(); 34 $result['tabs'] = array();
32 - foreach ($single['tabs'] as $key => $one)  
33 - { 35 + foreach ($single['tabs'] as $key => $one) {
34 $tabItem = array(); 36 $tabItem = array();
35 $tabItem['title'] = $one; 37 $tabItem['title'] = $one;
36 - if($key === 1)  
37 - { 38 + if ($key === 1) {
38 $tabItem['focus'] = true; 39 $tabItem['focus'] = true;
39 } 40 }
40 $result['tabs'][] = $tabItem; 41 $result['tabs'][] = $tabItem;
@@ -43,24 +44,21 @@ class NewSaleProcess @@ -43,24 +44,21 @@ class NewSaleProcess
43 } 44 }
44 45
45 // 处理商品 46 // 处理商品
46 - $productsLi = array('goods'=>array());  
47 - if(isset($single['product_list']))  
48 - {  
49 - foreach ($single['product_list'] as $value)  
50 - {  
51 - $productsLi['goods'][] = Helpers::formatProduct($value); 47 + $productsLi = array();
  48 + if (isset($single['product_list'])) {
  49 + foreach ($single['product_list'] as $value) {
  50 + $productsLi['goods'][] = Helpers::formatProduct($value, true, false);
52 } 51 }
53 } 52 }
54 - 53 +
55 // 对于第一个productsLi添加show字段 54 // 对于第一个productsLi添加show字段
56 - if(count($result['goodsContainer']) === 0)  
57 - { 55 + if (!isset($result['goodsContainer'][0])) {
58 $productsLi['show'] = true; 56 $productsLi['show'] = true;
59 } 57 }
60 58
61 $result['goodsContainer'][] = $productsLi; 59 $result['goodsContainer'][] = $productsLi;
62 } 60 }
63 - 61 +
64 return $result; 62 return $result;
65 } 63 }
66 64
@@ -72,9 +70,9 @@ class NewSaleProcess @@ -72,9 +70,9 @@ class NewSaleProcess
72 */ 70 */
73 public static function selectData($data) 71 public static function selectData($data)
74 { 72 {
75 - $result = array('goods'=>array());  
76 - if($data['code'] === 200)  
77 - { 73 + $result = array('goods' => array());
  74 +
  75 + if (isset($data['code']) && $data['code'] === 200) {
78 foreach ($data['data']['product_list'] as $val) { 76 foreach ($data['data']['product_list'] as $val) {
79 $result['goods'][] = Helpers::formatProduct($val); 77 $result['goods'][] = Helpers::formatProduct($val);
80 } 78 }
@@ -83,27 +81,4 @@ class NewSaleProcess @@ -83,27 +81,4 @@ class NewSaleProcess
83 return $result; 81 return $result;
84 } 82 }
85 83
86 - /**  
87 - * 处理页面顶部焦点图数据  
88 - *  
89 - * @param array $data 接口传回的焦点图数据  
90 - * @return array 处理之后的数据  
91 - */  
92 - private static function bannerData($data)  
93 - {  
94 - $result = array('list'=>array());  
95 -  
96 - foreach ($data as $single)  
97 - {  
98 - foreach ($single['data'] as $one)  
99 - {  
100 - $banner = array();  
101 - $banner['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);  
102 - $banner['url'] = $one['url'];  
103 - $result['list'][] = $banner;  
104 - }  
105 - }  
106 -  
107 - return $result;  
108 - }  
109 } 84 }
@@ -20,7 +20,7 @@ class Helpers @@ -20,7 +20,7 @@ class Helpers
20 { 20 {
21 return strtr($url, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode)); 21 return strtr($url, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode));
22 } 22 }
23 - 23 +
24 /** 24 /**
25 * 获取过滤后的URL链接 25 * 获取过滤后的URL链接
26 * 26 *
@@ -29,16 +29,23 @@ class Helpers @@ -29,16 +29,23 @@ class Helpers
29 */ 29 */
30 public static function getFilterUrl($url) 30 public static function getFilterUrl($url)
31 { 31 {
32 - return strstr($url, '&openby:yohobuy=', true); 32 + $filter = strstr($url, 'openby:yohobuy=', true);
  33 + if ($filter) {
  34 + return rtrim(rtrim($filter, '?'), '&');
  35 + } else {
  36 + return $url;
  37 + }
33 } 38 }
34 39
35 /** 40 /**
36 * 格式化商品信息 41 * 格式化商品信息
37 * 42 *
38 * @param array $productData 需要格式化的商品数据 43 * @param array $productData 需要格式化的商品数据
  44 + * @param bool $showTag 控制是否显示标签
  45 + * @param bool $showNew 控制是否显示NEW图标
39 * @return array | false 46 * @return array | false
40 */ 47 */
41 - public static function formatProduct($productData, $showTags = true) 48 + public static function formatProduct($productData, $showTags = true, $showNew = true)
42 { 49 {
43 // 商品信息有问题,则不显示 50 // 商品信息有问题,则不显示
44 if (!isset($productData['product_skn'])) { 51 if (!isset($productData['product_skn'])) {
@@ -62,7 +69,7 @@ class Helpers @@ -62,7 +69,7 @@ class Helpers
62 69
63 if ($showTags) { 70 if ($showTags) {
64 $result['tags'] = array(); 71 $result['tags'] = array();
65 - $result['tags']['is_new'] = isset($productData['is_new']) && $productData['is_new'] === 'Y'; // 新品 72 + $result['tags']['is_new'] = $showNew && isset($productData['is_new']) && $productData['is_new'] === 'Y'; // 新品
66 $result['tags']['is_discount'] = isset($productData['is_discount']) && $productData['is_discount'] === 'Y'; // 在售 73 $result['tags']['is_discount'] = isset($productData['is_discount']) && $productData['is_discount'] === 'Y'; // 在售
67 $result['tags']['is_limited'] = isset($productData['is_limited']) && $productData['is_limited'] === 'Y'; // 限量 74 $result['tags']['is_limited'] = isset($productData['is_limited']) && $productData['is_limited'] === 'Y'; // 限量
68 $result['tags']['is_yohood'] = isset($productData['is_yohood']) && $productData['is_yohood'] === 'Y'; // YOHOOD 75 $result['tags']['is_yohood'] = isset($productData['is_yohood']) && $productData['is_yohood'] === 'Y'; // YOHOOD
@@ -73,7 +80,7 @@ class Helpers @@ -73,7 +80,7 @@ class Helpers
73 80
74 return $result; 81 return $result;
75 } 82 }
76 - 83 +
77 /** 84 /**
78 * 格式化资讯文章 85 * 格式化资讯文章
79 * 86 *
@@ -84,12 +91,12 @@ class Helpers @@ -84,12 +91,12 @@ class Helpers
84 * @return array | false 91 * @return array | false
85 */ 92 */
86 public static function formatArticle($articleData, $showTag = true, $share = false, $showAuthor = true) 93 public static function formatArticle($articleData, $showTag = true, $share = false, $showAuthor = true)
87 - { 94 + {
88 // 资讯ID不存在,则不显示 95 // 资讯ID不存在,则不显示
89 if (!isset($articleData['id'])) { 96 if (!isset($articleData['id'])) {
90 return false; 97 return false;
91 } 98 }
92 - 99 +
93 $result = array(); 100 $result = array();
94 $result['id'] = $articleData['id']; 101 $result['id'] = $articleData['id'];
95 $result['showTags'] = $showTag; 102 $result['showTags'] = $showTag;
@@ -106,12 +113,12 @@ class Helpers @@ -106,12 +113,12 @@ class Helpers
106 // $result['collect'] = array(); 113 // $result['collect'] = array();
107 // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; 114 // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
108 $result['share'] = $share; 115 $result['share'] = $share;
109 - 116 +
110 // 判断是否显示作者信息 117 // 判断是否显示作者信息
111 if ($showAuthor) { 118 if ($showAuthor) {
112 $result['author'] = empty($articleData['author']) ? false : $articleData['author']; 119 $result['author'] = empty($articleData['author']) ? false : $articleData['author'];
113 } 120 }
114 - 121 +
115 // 模板中需要的标签标识 122 // 模板中需要的标签标识
116 if ($showTag && isset($articleData['category_id'])) { 123 if ($showTag && isset($articleData['category_id'])) {
117 switch (strval($articleData['category_id'])) { 124 switch (strval($articleData['category_id'])) {
@@ -137,6 +144,28 @@ class Helpers @@ -137,6 +144,28 @@ class Helpers
137 } 144 }
138 145
139 /** 146 /**
  147 + * 格式化广告焦点图数据
  148 + *
  149 + * @param array $bannerData 需要格式化的广告图数据
  150 + * @param int $width 图片的宽度
  151 + * @param int $height 图片的高度
  152 + * @param int $mode 使用的七牛模式
  153 + * @return array
  154 + */
  155 + public static function formatBanner($bannerData, $width, $height, $mode = 2)
  156 + {
  157 + $result = array();
  158 +
  159 + $result['img'] = self::getImageUrl($bannerData['src'], $width, $height, $mode);
  160 + if (isset($bannerData['url'])) {
  161 + $result['url'] = self::getFilterUrl($bannerData['url']);
  162 + }
  163 + $result['title'] = $bannerData['title'];
  164 +
  165 + return $result;
  166 + }
  167 +
  168 + /**
140 * 生成公开的TOKEN凭证 169 * 生成公开的TOKEN凭证
141 * 170 *
142 * @param string $string 字符串 171 * @param string $string 字符串
@@ -158,8 +187,7 @@ class Helpers @@ -158,8 +187,7 @@ class Helpers
158 { 187 {
159 if ($token === self::makeToken($string)) { 188 if ($token === self::makeToken($string)) {
160 return true; 189 return true;
161 - }  
162 - else { 190 + } else {
163 return false; 191 return false;
164 } 192 }
165 } 193 }
@@ -291,7 +319,7 @@ class Helpers @@ -291,7 +319,7 @@ class Helpers
291 * @param int $type 319 * @param int $type
292 * @return array 320 * @return array
293 */ 321 */
294 - public static function getProductIcon($type) 322 + public static function getProductIcon($type)
295 { 323 {
296 static $icons = array( 324 static $icons = array(
297 1 => 'cloth', 325 1 => 'cloth',
@@ -306,8 +334,8 @@ class Helpers @@ -306,8 +334,8 @@ class Helpers
306 308 => 'under' 334 308 => 'under'
307 ); 335 );
308 $type = intval($type); 336 $type = intval($type);
309 - 337 +
310 return isset($icons[$type]) ? $icons[$type] : ''; 338 return isset($icons[$type]) ? $icons[$type] : '';
311 } 339 }
312 - 340 +
313 } 341 }
1 <?php 1 <?php
2 2
3 -namespace Plugin\Partner\Alipay; 3 +namespace Plugin\Partner\alipay;
4 4
5 use Plugin\Partner\Factory; 5 use Plugin\Partner\Factory;
6 6
1 <?php 1 <?php
2 2
3 -namespace Plugin\Partner\Qqconnect; 3 +namespace Plugin\Partner\qqconnect;
4 4
5 use Plugin\Partner\Factory; 5 use Plugin\Partner\Factory;
6 6
1 <?php 1 <?php
2 2
3 -namespace Plugin\Partner\Sinaweibo; 3 +namespace Plugin\Partner\sinaweibo;
4 4
5 use Plugin\Partner\Factory; 5 use Plugin\Partner\Factory;
6 6
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 RewriteCond %{REQUEST_FILENAME} !-f 9 RewriteCond %{REQUEST_FILENAME} !-f
10 RewriteCond %{REQUEST_FILENAME} !-d 10 RewriteCond %{REQUEST_FILENAME} !-d
11 RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$ 11 RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
12 - RewriteRule ^/(.+)$ /index.php [L] 12 + RewriteRule ^/(.+)$ /index-test.php [L]
13 <Directory /> 13 <Directory />
14 LimitRequestBody 10485760 14 LimitRequestBody 10485760
15 Options FollowSymLinks 15 Options FollowSymLinks
@@ -24,15 +24,15 @@ @@ -24,15 +24,15 @@
24 ServerAdmin root@localhost 24 ServerAdmin root@localhost
25 CustomLog "/Data/logs/apache/access.guang.test.yoho.cn.log" combined 25 CustomLog "/Data/logs/apache/access.guang.test.yoho.cn.log" combined
26 ErrorLog "/Data/logs/apache/error.guang.test.yoho.cn.log" 26 ErrorLog "/Data/logs/apache/error.guang.test.yoho.cn.log"
27 - ServerName guang.test.yoho.cn 27 + ServerName guang.buy.test.yoho.cn
28 DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public" 28 DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public"
29 RewriteEngine on 29 RewriteEngine on
30 RewriteCond %{REQUEST_FILENAME} !-f 30 RewriteCond %{REQUEST_FILENAME} !-f
31 RewriteCond %{REQUEST_FILENAME} !-d 31 RewriteCond %{REQUEST_FILENAME} !-d
32 RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$ 32 RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
33 RewriteCond %{QUERY_STRING} ^(.*)$ 33 RewriteCond %{QUERY_STRING} ^(.*)$
34 - RewriteRule / /index.php?/guang/list/index&%1 [L]  
35 - RewriteRule ^/(.+)$ /index.php [L] 34 + RewriteRule / /index.php/guang/list/index?%1 [L]
  35 + RewriteRule ^/(.+)$ /index-test.php [L]
36 <Directory /> 36 <Directory />
37 LimitRequestBody 10485760 37 LimitRequestBody 10485760
38 Options FollowSymLinks 38 Options FollowSymLinks
1 server 1 server
2 { 2 {
3 listen 80; 3 listen 80;
4 - server_name buy.test.yoho.cn guang.test.yoho.cn; 4 + server_name buy.test.yoho.cn guang.buy.test.yoho.cn;
5 5
6 #access_log /Data/logs/access.buy.test.yoho.cn.log combined; 6 #access_log /Data/logs/access.buy.test.yoho.cn.log combined;
7 error_log /Data/logs/error.buy.test.yoho.cn.log warn; 7 error_log /Data/logs/error.buy.test.yoho.cn.log warn;
@@ -25,7 +25,6 @@ class BoysController extends AbstractAction @@ -25,7 +25,6 @@ class BoysController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
28 - 'searchUrl' => '/search',  
29 'boysHomePage' => true, 28 'boysHomePage' => true,
30 'maybeLike' => true, 29 'maybeLike' => true,
31 'content' => Index\HomeModel::getBoysFloor() 30 'content' => Index\HomeModel::getBoysFloor()
@@ -25,7 +25,6 @@ class GirlsController extends AbstractAction @@ -25,7 +25,6 @@ class GirlsController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
28 - 'searchUrl' => '/search',  
29 'grilsHomePage' => true, 28 'grilsHomePage' => true,
30 'maybeLike' => true, 29 'maybeLike' => true,
31 'content' => Index\HomeModel::getGirlsFloor() 30 'content' => Index\HomeModel::getGirlsFloor()
@@ -25,7 +25,6 @@ class KidsController extends AbstractAction @@ -25,7 +25,6 @@ class KidsController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
28 - 'searchUrl' => '/search',  
29 'kidsHomePage' => true, 28 'kidsHomePage' => true,
30 'maybeLike' => true, 29 'maybeLike' => true,
31 'content' => Index\HomeModel::getKidsFloor() 30 'content' => Index\HomeModel::getKidsFloor()
@@ -25,7 +25,6 @@ class LifestyleController extends AbstractAction @@ -25,7 +25,6 @@ class LifestyleController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
28 - 'searchUrl' => '/search',  
29 'lifestyleHomePage' => true, 28 'lifestyleHomePage' => true,
30 'maybeLike' => true, 29 'maybeLike' => true,
31 'content' => Index\HomeModel::getLifestyleFloor() 30 'content' => Index\HomeModel::getLifestyleFloor()
@@ -20,7 +20,6 @@ use Configs\CacheConfig; @@ -20,7 +20,6 @@ use Configs\CacheConfig;
20 class HomeModel 20 class HomeModel
21 { 21 {
22 /* 频道选择页取背景图片的位置码 */ 22 /* 频道选择页取背景图片的位置码 */
23 -  
24 const CODE_BG = '7ba9118028f9b22090b57341487567eb'; 23 const CODE_BG = '7ba9118028f9b22090b57341487567eb';
25 24
26 /* 男生楼层资源的位置码 */ 25 /* 男生楼层资源的位置码 */
@@ -72,7 +71,7 @@ class HomeModel @@ -72,7 +71,7 @@ class HomeModel
72 */ 71 */
73 public static function setSwitchToCookie($cookie) 72 public static function setSwitchToCookie($cookie)
74 { 73 {
75 - setcookie('_Channel', $cookie, time() + 86400 * 300, '/', '.' . SITE_DOMAIN); 74 + setcookie('_Channel', $cookie, time() + 86400 * 300, '/', COOKIE_DOMAIN);
76 } 75 }
77 76
78 /** 77 /**
  1 +<?php
  2 +
  3 +namespace Product;
  4 +
  5 +use Configs\CacheConfig;
  6 +use LibModels\Wap\Product\NewsaleData;
  7 +use Plugin\DataProcess\NewSaleProcess;
  8 +use Plugin\Helpers;
  9 +
  10 +/**
  11 + * 新品到着相关的模板数据模型
  12 + *
  13 + * @name NewsaleModel
  14 + * @package models/Product
  15 + * @copyright yoho.inc
  16 + * @version 1.0 (2015-10-22 17:23:51)
  17 + * @author fei.hong <fei.hong@yoho.cn>
  18 + */
  19 +class NewsaleModel
  20 +{
  21 +
  22 + /* 获取新品到着顶部焦点图的位置码 */
  23 + const CODE_FOCUS_NEW = 'a7989369aa86681c678bc40f171b8f1d';
  24 + /* 获取折扣专区顶部焦点图的位置码 */
  25 + const CODE_FOCUS_SALE = 'e9c9be32d72e2906d404a72ee24cb523';
  26 +
  27 + /**
  28 + * 获取新品到着的焦点图资源数据
  29 + *
  30 + * @return array
  31 + */
  32 + public static function getNewFocus()
  33 + {
  34 + $result = array();
  35 +
  36 + if (USE_CACHE) {
  37 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  38 + $result = Cache::get(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, 'master');
  39 + if (!empty($result)) {
  40 + return $result;
  41 + }
  42 + }
  43 +
  44 + // 调用接口获取数据并封装
  45 + $newsale = NewsaleData::getNewsaleFocus(self::CODE_FOCUS_NEW);
  46 + if (isset($newsale['code']) && isset($newsale['data'][0]['data'][0])) {
  47 + $result = Helpers::formatBanner($newsale['data'][0]['data'][0], 640, 240);
  48 + }
  49 +
  50 + if (USE_CACHE) {
  51 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  52 + if (empty($result)) {
  53 + $result = Cache::get(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, 'slave');
  54 + }
  55 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  56 + else {
  57 + Cache::set(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, $result);
  58 + }
  59 + }
  60 +
  61 + return $result;
  62 + }
  63 +
  64 + /**
  65 + * 获取折扣专区的焦点图资源数据
  66 + *
  67 + * @return array
  68 + */
  69 + public static function getSaleFocus()
  70 + {
  71 + $result = array();
  72 +
  73 + if (USE_CACHE) {
  74 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  75 + $result = Cache::get(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, 'master');
  76 + if (!empty($result)) {
  77 + return $result;
  78 + }
  79 + }
  80 +
  81 + // 调用接口获取数据并封装
  82 + $newsale = NewsaleData::getNewsaleFocus(self::CODE_FOCUS_SALE);
  83 + if (isset($newsale['code']) && isset($newsale['data'][0]['data'][0])) {
  84 + $result = Helpers::formatBanner($newsale['data'][0]['data'][0], 640, 240);
  85 + }
  86 +
  87 + if (USE_CACHE) {
  88 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  89 + if (empty($result)) {
  90 + $result = Cache::get(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, 'slave');
  91 + }
  92 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  93 + else {
  94 + Cache::set(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, $result);
  95 + }
  96 + }
  97 +
  98 + return $result;
  99 + }
  100 +
  101 + /**
  102 + * 获取新品到着的商品列表
  103 + *
  104 + * @param int $channel 1:男生,2:女生,3:潮童,4:创意生活
  105 + * @param int $limit 查询的限制数
  106 + * @return array
  107 + */
  108 + public static function getNewProducts($channel, $limit)
  109 + {
  110 + $result = array();
  111 + $products = array();
  112 +
  113 + /* 根据频道查询商品列表 */
  114 + switch (intval($channel)) {
  115 + case 1: // 男生
  116 + $products = NewsaleData::getNewProducts('1,3', 1, $limit);
  117 + break;
  118 + case 2: // 女生
  119 + $products = NewsaleData::getNewProducts('2,3', 2, $limit);
  120 + break;
  121 + case 3: // 潮童
  122 + $products = NewsaleData::getNewProducts('1,2,3', 3, $limit);
  123 + break;
  124 + case 4: // 创意生活
  125 + $products = NewsaleData::getNewProducts('1,2,3', 4, $limit);
  126 + break;
  127 + }
  128 +
  129 + /* 格式化商品数据 */
  130 + if (!empty($products)) {
  131 + $result = NewSaleProcess::newSaleData($products);
  132 + }
  133 +
  134 + return $result;
  135 + }
  136 +
  137 + /**
  138 + * 获取折扣专区的商品列表
  139 + *
  140 + * @param int $channel 1:男生,2:女生,3:潮童,4:创意生活
  141 + * @param int $limit 查询的限制数
  142 + * @return array
  143 + */
  144 + public static function getSaleProducts($channel, $limit)
  145 + {
  146 + $result = array();
  147 + $products = array();
  148 +
  149 + /* 根据频道查询商品列表 */
  150 + switch (intval($channel)) {
  151 + case 1: // 男生
  152 + $products = NewsaleData::getSaleProducts('1,3', 1, $limit);
  153 + break;
  154 + case 2: // 女生
  155 + $products = NewsaleData::getSaleProducts('2,3', 2, $limit);
  156 + break;
  157 + case 3: // 潮童
  158 + $products = NewsaleData::getSaleProducts('1,2,3', 3, $limit);
  159 + break;
  160 + case 4: // 创意生活
  161 + $products = NewsaleData::getSaleProducts('1,2,3', 4, $limit);
  162 + break;
  163 + }
  164 +
  165 + /* 格式化商品数据 */
  166 + if (!empty($products)) {
  167 + $result = NewSaleProcess::newSaleData($products);
  168 + }
  169 +
  170 + return $result;
  171 + }
  172 +
  173 +}
@@ -77,15 +77,21 @@ class DetailController extends AbstractAction @@ -77,15 +77,21 @@ class DetailController extends AbstractAction
77 } 77 }
78 // 通过SKN获取商品信息 78 // 通过SKN获取商品信息
79 $product = ListData::productInfoBySkns($skns); 79 $product = ListData::productInfoBySkns($skns);
80 - foreach ($product['data']['product_list'] as $i => $goods) {  
81 - // 最多显示4个  
82 - if ($i > 3) {  
83 - break; 80 + if (!empty($product['data']['product_list'])) {
  81 + foreach ($product['data']['product_list'] as $i => $goods) {
  82 + // 最多显示4个
  83 + if ($i > 3) {
  84 + break;
  85 + }
  86 + $good[] = Helpers::formatProduct($goods, false);
84 } 87 }
85 - $good[] = Helpers::formatProduct($goods, false); 88 + }
  89 + // 没有商品
  90 + if (!isset($i)) {
  91 + continue;
86 } 92 }
87 // 单个商品 93 // 单个商品
88 - if ($i === 0) { 94 + elseif ($i === 0) {
89 $build['relatedReco'] = $good[0]; 95 $build['relatedReco'] = $good[0];
90 } 96 }
91 // 多个商品 97 // 多个商品
@@ -106,10 +112,12 @@ class DetailController extends AbstractAction @@ -106,10 +112,12 @@ class DetailController extends AbstractAction
106 } 112 }
107 // 通过SKN获取商品信息 113 // 通过SKN获取商品信息
108 $product = ListData::productInfoBySkns($skns); 114 $product = ListData::productInfoBySkns($skns);
109 - foreach ($product['data']['product_list'] as $i => $goods) {  
110 - $good['goods'][] = Helpers::formatProduct($goods, false); 115 + if (!empty($product['data']['product_list'])) {
  116 + foreach ($product['data']['product_list'] as $i => $goods) {
  117 + $good['goods'][] = Helpers::formatProduct($goods, false);
  118 + }
  119 + $build['collocation'][] = $good;
111 } 120 }
112 - $build['collocation'][] = $good;  
113 } 121 }
114 } 122 }
115 123
@@ -18,6 +18,7 @@ class ListController extends AbstractAction @@ -18,6 +18,7 @@ class ListController extends AbstractAction
18 public function indexAction() 18 public function indexAction()
19 { 19 {
20 $this->setTitle('逛'); 20 $this->setTitle('逛');
  21 + $this->setNavHeader('逛', true, SITE_DOMAIN);
21 22
22 $category = ListData::category(); 23 $category = ListData::category();
23 $articleGroup = array(); 24 $articleGroup = array();
@@ -58,6 +59,11 @@ class ListController extends AbstractAction @@ -58,6 +59,11 @@ class ListController extends AbstractAction
58 $data['guang']['swiper'] = array(); 59 $data['guang']['swiper'] = array();
59 $data['guang']['infos'] = array(); 60 $data['guang']['infos'] = array();
60 foreach ($articleGroup as $id => $value) { 61 foreach ($articleGroup as $id => $value) {
  62 + // 判断是否有内容
  63 + if (empty($value['list'])) {
  64 + continue;
  65 + }
  66 +
61 // 轮番广告 67 // 轮番广告
62 if ($id == 0) { 68 if ($id == 0) {
63 $build = array(); 69 $build = array();
@@ -101,6 +107,9 @@ class ListController extends AbstractAction @@ -101,6 +107,9 @@ class ListController extends AbstractAction
101 $this->error(); 107 $this->error();
102 } 108 }
103 109
  110 + $this->setTitle($tag);
  111 + $this->setNavHeader($tag, true, SITE_DOMAIN);
  112 +
104 $data = array(); 113 $data = array();
105 // 模板中使用JS的标识 114 // 模板中使用JS的标识
106 $data['guangList'] = true; 115 $data['guangList'] = true;
@@ -115,8 +124,6 @@ class ListController extends AbstractAction @@ -115,8 +124,6 @@ class ListController extends AbstractAction
115 // 分页需要的参数 124 // 分页需要的参数
116 $data['guang']['tag'] = $tag; 125 $data['guang']['tag'] = $tag;
117 126
118 - $this->setTitle($tag);  
119 -  
120 $this->_view->display('list', $data); 127 $this->_view->display('list', $data);
121 } 128 }
122 129
@@ -126,8 +133,6 @@ class ListController extends AbstractAction @@ -126,8 +133,6 @@ class ListController extends AbstractAction
126 public function editorAction() 133 public function editorAction()
127 { 134 {
128 $id = $this->get('id'); 135 $id = $this->get('id');
129 - $uid = $this->getUid();  
130 - $udid = $this->getUdid();  
131 136
132 // 获取作者信息 137 // 获取作者信息
133 $author = ListData::author($id); 138 $author = ListData::author($id);
@@ -137,6 +142,10 @@ class ListController extends AbstractAction @@ -137,6 +142,10 @@ class ListController extends AbstractAction
137 } 142 }
138 143
139 $this->setTitle('编辑简介'); 144 $this->setTitle('编辑简介');
  145 + $this->setNavHeader('编辑简介', true, SITE_DOMAIN);
  146 +
  147 + $uid = $this->getUid();
  148 + $udid = $this->getUdid();
140 149
141 $data = array(); 150 $data = array();
142 // 模板中使用JS的标识 151 // 模板中使用JS的标识
@@ -185,7 +194,7 @@ class ListController extends AbstractAction @@ -185,7 +194,7 @@ class ListController extends AbstractAction
185 194
186 /* 判断参数是否有效 */ 195 /* 判断参数是否有效 */
187 $tag = $this->get('tag'); 196 $tag = $this->get('tag');
188 - $sortId = $this->get('type'); 197 + $sortId = $this->get('type', 0);
189 $page = $this->get('page'); 198 $page = $this->get('page');
190 $gender = $this->get('gender'); 199 $gender = $this->get('gender');
191 $authorId = $this->get('authorId'); 200 $authorId = $this->get('authorId');
@@ -203,7 +212,7 @@ class ListController extends AbstractAction @@ -203,7 +212,7 @@ class ListController extends AbstractAction
203 /* 获取资讯文章列表 */ 212 /* 获取资讯文章列表 */
204 $uid = $this->getUid(); 213 $uid = $this->getUid();
205 $udid = $this->getUdid(); 214 $udid = $this->getUdid();
206 - $article = ListData::article($gender, 0, $uid, $udid, $page, $tag, $authorId); 215 + $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
207 if (empty($article['data']['list']['artList'])) { 216 if (empty($article['data']['list']['artList'])) {
208 break; 217 break;
209 } 218 }
@@ -122,8 +122,8 @@ class BackController extends AbstractAction @@ -122,8 +122,8 @@ class BackController extends AbstractAction
122 'countryCode' => '+86' 122 'countryCode' => '+86'
123 ); 123 );
124 124
125 - // 生成HTML (mobileback.html)  
126 - $this->_view->html('mobileback.html'); 125 + // 生成HTML (phoneback.html)
  126 + $this->_view->html('phoneback');
127 127
128 $this->_view->display('mobile', $data); 128 $this->_view->display('mobile', $data);
129 } 129 }
@@ -28,7 +28,7 @@ class LoginController extends AbstractAction @@ -28,7 +28,7 @@ class LoginController extends AbstractAction
28 'aliLoginUrl' => '/passport/login/alipay', // 支付宝快捷登录的URL链接 28 'aliLoginUrl' => '/passport/login/alipay', // 支付宝快捷登录的URL链接
29 'weiboLoginUrl' => '/passport/login/sina', // 微博登录的URL链接 29 'weiboLoginUrl' => '/passport/login/sina', // 微博登录的URL链接
30 'qqLoginUrl' => '/passport/login/qq', // 腾讯QQ登录的URL链接 30 'qqLoginUrl' => '/passport/login/qq', // 腾讯QQ登录的URL链接
31 - 'interationalUrl' => '/login.html', // 国际号登录的URL链接 31 + 'internationalUrl' => '/login.html', // 国际号登录的URL链接
32 'phoneRetriveUrl' => '/passport/back/mobile', // 通过手机号找回密码的URL链接 32 'phoneRetriveUrl' => '/passport/back/mobile', // 通过手机号找回密码的URL链接
33 'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接 33 'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接
34 ); 34 );
@@ -47,7 +47,7 @@ class LoginController extends AbstractAction @@ -47,7 +47,7 @@ class LoginController extends AbstractAction
47 $this->setTitle('国际账号登录'); 47 $this->setTitle('国际账号登录');
48 48
49 $data = array(); 49 $data = array();
50 - $data['loginInterational'] = true; // 模板中使用JS的标识 50 + $data['loginInternational'] = true; // 模板中使用JS的标识
51 $data['backUrl'] = '/'; // 返回的URL链接 51 $data['backUrl'] = '/'; // 返回的URL链接
52 $data['headerText'] = '登录'; // 头部信息 52 $data['headerText'] = '登录'; // 头部信息
53 $data['isPassportPage'] = true; // 模板中模块标识 53 $data['isPassportPage'] = true; // 模板中模块标识
@@ -10,33 +10,54 @@ use Plugin\DataProcess\NewSaleProcess; @@ -10,33 +10,54 @@ use Plugin\DataProcess\NewSaleProcess;
10 class NewsaleController extends AbstractAction 10 class NewsaleController extends AbstractAction
11 { 11 {
12 12
  13 + /**
  14 + * 新品到着
  15 + *
  16 + * @param int channel 1:男生,2:女生,3:潮童,4:创意生活
  17 + */
13 public function indexAction() 18 public function indexAction()
14 { 19 {
15 $this->setTitle('新品到着'); 20 $this->setTitle('新品到着');
  21 + $this->setNavHeader('新品到着');
16 22
17 - $data = array(  
18 - 'newArrival' => true,  
19 - 'pageHeader' => array(  
20 - 'navBack' => true,  
21 - 'navTitle' => '新品到着',  
22 - 'navHome' => '/'  
23 - )  
24 - ); 23 + $channel = $this->get('channel', 1);
  24 + if (!is_numeric($channel)) {
  25 + $this->error();
  26 + }
25 27
26 - // 新品到着顶部焦点图  
27 - $focusData = NewsaleData::getNewsaleFocus('a7989369aa86681c678bc40f171b8f1d');  
28 - // 处理返回的数据  
29 - $focus = array();  
30 - if (isset($focusData['code']) && $focusData['code'] == 200) {  
31 - $focus = $focusData['data']; 28 + $data = array();
  29 + $data['newArrival'] = true;
  30 + $data['headerBanner'] = \Product\NewsaleModel::getNewFocus();
  31 + $goodsList = \Product\NewsaleModel::getNewProducts($channel, 20);
  32 + if (!empty($goodsList)) {
  33 + $data += $goodsList;
32 } 34 }
  35 + $this->_view->display('new', $data);
  36 + }
33 37
34 - // 批量获取新品到着商品数据  
35 - $products = NewsaleData::getNewProducts('1,3', 1, 60);  
36 - // 添加商品数据  
37 - $data += NewSaleProcess::newSaleData($focus, $products); 38 + /**
  39 + * 折扣专区
  40 + *
  41 + * @param int channel 1:男生,2:女生,3:潮童,4:创意生活
  42 + */
  43 + public function discountAction()
  44 + {
  45 + $this->setTitle('折扣专区');
  46 + $this->setNavHeader('Sale');
38 47
39 - $this->_view->display('new', $data); 48 + $channel = $this->get('channel', 1);
  49 + if (!is_numeric($channel)) {
  50 + $this->error();
  51 + }
  52 +
  53 + $data = array();
  54 + $data['discount'] = true;
  55 + $data['headerBanner'] = \Product\NewsaleModel::getNewFocus();
  56 + $goodsList = \Product\NewsaleModel::getSaleProducts($channel, 20);
  57 + if (!empty($goodsList)) {
  58 + $data += $goodsList;
  59 + }
  60 + $this->_view->display('sale', $data);
40 } 61 }
41 62
42 /** 63 /**
@@ -56,61 +77,19 @@ class NewsaleController extends AbstractAction @@ -56,61 +77,19 @@ class NewsaleController extends AbstractAction
56 $p_d = $this->get('p_d', null); 77 $p_d = $this->get('p_d', null);
57 $channel = $this->get('channel', '1'); 78 $channel = $this->get('channel', '1');
58 $dayLimit = $this->get('dayLimit', '1'); 79 $dayLimit = $this->get('dayLimit', '1');
59 - $limit = $this->get('limit', 50); 80 + $limit = $this->get('limit', 20);
60 $page = $this->get('page', 1); 81 $page = $this->get('page', 1);
61 82
62 - $data = NewsaleData::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);  
63 - 83 + $data = NewsaleData::selectNewSaleProducts(
  84 + $gender, $brand, $sort, $color,
  85 + $size, $price, $p_d, $channel, $dayLimit, $limit, $page
  86 + );
64 $result = NewSaleProcess::selectData($data); 87 $result = NewSaleProcess::selectData($data);
65 88
66 $this->_view->display('product', $result); 89 $this->_view->display('product', $result);
  90 + } else {
  91 + echo ' ';
67 } 92 }
68 } 93 }
69 94
70 - /**  
71 - * 折扣专区  
72 - */  
73 - public function discountAction()  
74 - {  
75 - $this->setTitle('折扣专区');  
76 -  
77 - $data = array(  
78 - 'discount' => true,  
79 - 'pageHeader' => array(  
80 - 'navBack' => true,  
81 - 'navTitle' => 'SALE',  
82 - 'navHome' => '/'  
83 - )  
84 - );  
85 -  
86 - // 折扣专区顶部焦点图  
87 - $focusData = NewsaleData::getNewsaleFocus('e9c9be32d72e2906d404a72ee24cb523');  
88 - // 处理返回的数据  
89 - $focus = array();  
90 - if (isset($focusData['code']) && $focusData['code'] == 200) {  
91 - $focus = $focusData['data'];  
92 - }  
93 -  
94 - // 折扣专区商品数据  
95 - $products = NewsaleData::getSaleProducts('1,3', 1);  
96 - // 更新tabs  
97 - $tabs = array();  
98 - foreach (array_keys($products) as $key => $value) {  
99 - $tabItem = array();  
100 - $tabItem['title'] = $value;  
101 - if ($key === 0) {  
102 - $tabItem['focus'] = true;  
103 - }  
104 - $tabs[] = $tabItem;  
105 - }  
106 - $data['tabs'] = $tabs;  
107 - // 添加商品数据  
108 - $data += NewSaleProcess::newSaleData($focus, $products);  
109 -  
110 - /* echo '<pre>';  
111 - print_r($data);exit; */  
112 -  
113 - $this->_view->display('sale', $data);  
114 - }  
115 -  
116 } 95 }
@@ -47,6 +47,11 @@ class RecomController extends AbstractAction @@ -47,6 +47,11 @@ class RecomController extends AbstractAction
47 if (empty($recom['data']['product_list'])) { 47 if (empty($recom['data']['product_list'])) {
48 break; 48 break;
49 } 49 }
  50 +
  51 + /* 判断是否已没有数据 */
  52 + if (intval($page) > intval($recom['data']['page_total'])) {
  53 + break;
  54 + }
50 55
51 /* 构建商品数据 */ 56 /* 构建商品数据 */
52 $data = array(); 57 $data = array();
@@ -54,8 +59,8 @@ class RecomController extends AbstractAction @@ -54,8 +59,8 @@ class RecomController extends AbstractAction
54 $data['goods'][] = Helpers::formatProduct($value, true); 59 $data['goods'][] = Helpers::formatProduct($value, true);
55 } 60 }
56 $this->_view->display('maylike', $data); 61 $this->_view->display('maylike', $data);
57 - }  
58 - while (false); 62 +
  63 + } while (false);
59 64
60 echo ' '; 65 echo ' ';
61 } 66 }
@@ -81,19 +86,24 @@ class RecomController extends AbstractAction @@ -81,19 +86,24 @@ class RecomController extends AbstractAction
81 } 86 }
82 87
83 /* 取可能喜欢的数据 */ 88 /* 取可能喜欢的数据 */
84 - $recom = RecomData::mayLikeKids(); 89 + $recom = RecomData::mayLikeKids($page);
85 if (empty($recom['data']['product_list'])) { 90 if (empty($recom['data']['product_list'])) {
86 break; 91 break;
87 } 92 }
88 93
  94 + /* 判断是否已没有数据 */
  95 + if (intval($page) > intval($recom['data']['page_total'])) {
  96 + break;
  97 + }
  98 +
89 /* 构建模板需要的商品数据 */ 99 /* 构建模板需要的商品数据 */
90 $data = array(); 100 $data = array();
91 foreach ($recom['data']['product_list'] as $value) { 101 foreach ($recom['data']['product_list'] as $value) {
92 $data['goods'][] = Helpers::formatProduct($value, true); 102 $data['goods'][] = Helpers::formatProduct($value, true);
93 } 103 }
94 $this->_view->display('maylike', $data); 104 $this->_view->display('maylike', $data);
95 - }  
96 - while (false); 105 +
  106 + } while (false);
97 107
98 echo ' '; 108 echo ' ';
99 } 109 }
@@ -137,8 +147,8 @@ class RecomController extends AbstractAction @@ -137,8 +147,8 @@ class RecomController extends AbstractAction
137 $data['goodsContainer'][] = $build; 147 $data['goodsContainer'][] = $build;
138 } 148 }
139 $this->_view->display('maylikelife', $data); 149 $this->_view->display('maylikelife', $data);
140 - }  
141 - while (false); 150 +
  151 + } while (false);
142 152
143 echo ' '; 153 echo ' ';
144 } 154 }
@@ -178,5 +188,4 @@ class RecomController extends AbstractAction @@ -178,5 +188,4 @@ class RecomController extends AbstractAction
178 // $this->echoJson($data); 188 // $this->echoJson($data);
179 // } 189 // }
180 // } 190 // }
181 -  
182 } 191 }
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
4 -define('SITE_DOMAIN', 'm.dev.yohobuy.com'); // 网站主域名  
5 -define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名 4 +define('SITE_MAIN', 'http://m.dev.yohobuy.com'); // 网站主域名
  5 +define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
  6 +define('COOKIE_DOMAIN', '.m.dev.yohobuy.com'); // COOKIE作用域
6 define('USE_CACHE', false); // 缓存的开关 7 define('USE_CACHE', false); // 缓存的开关
7 define('APPLICATION_PATH', dirname(__DIR__)); 8 define('APPLICATION_PATH', dirname(__DIR__));
8 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
4 -define('SITE_DOMAIN', 'buy.test.yoho.cn'); // 网站主域名  
5 -define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名 4 +define('SITE_MAIN', 'http://buy.test.yoho.cn'); // 网站主域名
  5 +define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
  6 +define('COOKIE_DOMAIN', '.test.yoho.cn'); // COOKIE作用域
6 define('USE_CACHE', true); // 缓存的开关 7 define('USE_CACHE', true); // 缓存的开关
7 define('APPLICATION_PATH', dirname(__DIR__)); 8 define('APPLICATION_PATH', dirname(__DIR__));
8 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
4 -define('SITE_DOMAIN', 'wap.yohobuy.com'); // 网站主域名  
5 -define('OLD_DOMAIN', 'm.yohobuy.com'); // 网站旧域名 4 +define('SITE_MAIN', 'http://wap.m.yohobuy.com'); // 网站主域名
  5 +define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
  6 +define('COOKIE_DOMAIN', '.m.yohobuy.com'); // COOKIE作用域
6 define('USE_CACHE', true); // 缓存的开关 7 define('USE_CACHE', true); // 缓存的开关
7 define('APPLICATION_PATH', dirname(__DIR__)); 8 define('APPLICATION_PATH', dirname(__DIR__));
8 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));