Authored by Rock Zhang

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

Showing 37 changed files with 836 additions and 207 deletions
@@ -13,22 +13,22 @@ @@ -13,22 +13,22 @@
13 price: 1000, 13 price: 1000,
14 tags: [ 14 tags: [
15 { 15 {
16 - isNew: true //NEW 16 + is_new: true //NEW
17 }, 17 },
18 { 18 {
19 - isSale: true //SALE 19 + is_discount: true //SALE
20 }, 20 },
21 { 21 {
22 - isLimit: false //限量商品 22 + is_limited: false //限量商品
23 }, 23 },
24 { 24 {
25 - isNewFestival: false //新品节 25 + is_yohood: // YOHOOD
26 }, 26 },
27 { 27 {
28 - isReNew: true //再到着 28 + is_advance: true //再到着
29 } 29 }
30 ], 30 ],
31 - isFew: true //即将售罄 31 + is_soon_sold_out: true //即将售罄
32 } 32 }
33 33
34 ### 侧栏导航 34 ### 侧栏导航
@@ -702,4 +702,39 @@ @@ -702,4 +702,39 @@
702 url: '' 702 url: ''
703 } 703 }
704 ] 704 ]
  705 + }
  706 +
  707 +## 品牌
  708 +
  709 + {
  710 + bannerTop: {
  711 + list: [
  712 + {
  713 + url: '',
  714 + img: ''
  715 + },
  716 + ...
  717 + ]
  718 + },
  719 + hotBrand: {
  720 + list: [
  721 + {
  722 + url: '',
  723 + img: '',
  724 + name: ''
  725 + },
  726 + ...
  727 + ]
  728 + },
  729 + brandList: [
  730 + title: '',
  731 + list: {
  732 + name: '',
  733 + url: '',
  734 + isHot: true/false,
  735 + isNew: true/false
  736 + },
  737 + ...
  738 + ]
  739 +
705 } 740 }
@@ -25,12 +25,19 @@ class AbstractAction extends Controller_Abstract @@ -25,12 +25,19 @@ class AbstractAction extends Controller_Abstract
25 * @var object 25 * @var object
26 */ 26 */
27 protected $_request; 27 protected $_request;
28 - 28 +
29 /** 29 /**
30 * 用户相关信息 30 * 用户相关信息
31 */ 31 */
32 - protected $_uid;  
33 - protected $_uname; 32 + protected $_uid = 0;
  33 + protected $_uname = '';
  34 +
  35 + /**
  36 + * 存放模板数据
  37 + *
  38 + * @var array
  39 + */
  40 + protected $_data;
34 41
35 /** 42 /**
36 * 初始化 43 * 初始化
@@ -38,7 +45,7 @@ class AbstractAction extends Controller_Abstract @@ -38,7 +45,7 @@ class AbstractAction extends Controller_Abstract
38 public function init() 45 public function init()
39 { 46 {
40 $this->_request = $this->getRequest(); 47 $this->_request = $this->getRequest();
41 - 48 +
42 // 设置环境变量 49 // 设置环境变量
43 switch (APPLICATION_ENV) { 50 switch (APPLICATION_ENV) {
44 case 'production': // 生产 51 case 'production': // 生产
@@ -166,7 +173,7 @@ class AbstractAction extends Controller_Abstract @@ -166,7 +173,7 @@ class AbstractAction extends Controller_Abstract
166 { 173 {
167 return $this->_request->getCookie($name, $default); 174 return $this->_request->getCookie($name, $default);
168 } 175 }
169 - 176 +
170 /** 177 /**
171 * 设置缓存 178 * 设置缓存
172 * 179 *
@@ -179,7 +186,7 @@ class AbstractAction extends Controller_Abstract @@ -179,7 +186,7 @@ class AbstractAction extends Controller_Abstract
179 { 186 {
180 Cache::set($key, $value, $expire); 187 Cache::set($key, $value, $expire);
181 } 188 }
182 - 189 +
183 /** 190 /**
184 * 获取缓存 191 * 获取缓存
185 * 192 *
@@ -195,7 +202,7 @@ class AbstractAction extends Controller_Abstract @@ -195,7 +202,7 @@ class AbstractAction extends Controller_Abstract
195 return Cache::get($key, 'slave'); 202 return Cache::get($key, 'slave');
196 } 203 }
197 } 204 }
198 - 205 +
199 /** 206 /**
200 * 获取当前登录的用户ID 207 * 获取当前登录的用户ID
201 * 208 *
@@ -216,7 +223,7 @@ class AbstractAction extends Controller_Abstract @@ -216,7 +223,7 @@ class AbstractAction extends Controller_Abstract
216 } 223 }
217 return $this->_uid; 224 return $this->_uid;
218 } 225 }
219 - 226 +
220 /** 227 /**
221 * 获取客户端唯一标识 228 * 获取客户端唯一标识
222 * 229 *
@@ -231,7 +238,7 @@ class AbstractAction extends Controller_Abstract @@ -231,7 +238,7 @@ class AbstractAction extends Controller_Abstract
231 } 238 }
232 return $udid; 239 return $udid;
233 } 240 }
234 - 241 +
235 /** 242 /**
236 * 获取当前登录的用户名字 243 * 获取当前登录的用户名字
237 * 244 *
@@ -258,6 +265,7 @@ class AbstractAction extends Controller_Abstract @@ -258,6 +265,7 @@ class AbstractAction extends Controller_Abstract
258 * @param string $title 标题 265 * @param string $title 标题
259 * @return void 266 * @return void
260 */ 267 */
  268 +
261 protected function setTitle($title) 269 protected function setTitle($title)
262 { 270 {
263 $this->_view->assign('title', $title . ' | '); 271 $this->_view->assign('title', $title . ' | ');
@@ -336,7 +344,7 @@ class AbstractAction extends Controller_Abstract @@ -336,7 +344,7 @@ class AbstractAction extends Controller_Abstract
336 344
337 $this->_view->assign('pageFooter', $footer); 345 $this->_view->assign('pageFooter', $footer);
338 } 346 }
339 - 347 +
340 /** 348 /**
341 * 设置侧边栏信息 349 * 设置侧边栏信息
342 * 350 *
@@ -368,7 +376,7 @@ class AbstractAction extends Controller_Abstract @@ -368,7 +376,7 @@ class AbstractAction extends Controller_Abstract
368 'textCn' => '创意生活', 376 'textCn' => '创意生活',
369 'textEn' => 'LIFE STYLE', 377 'textEn' => 'LIFE STYLE',
370 'styleClass' => 'life', 378 'styleClass' => 'life',
371 - 'url' => '/life', 379 + 'url' => '/lifestyle',
372 ), 380 ),
373 4 => array( 381 4 => array(
374 'textCn' => '逛', 382 'textCn' => '逛',
@@ -407,9 +415,8 @@ class AbstractAction extends Controller_Abstract @@ -407,9 +415,8 @@ class AbstractAction extends Controller_Abstract
407 ) 415 )
408 ), 416 ),
409 )); 417 ));
410 -  
411 } 418 }
412 - 419 +
413 /** 420 /**
414 * 返回顶部软件下载有关数据 421 * 返回顶部软件下载有关数据
415 * @return array 下载有关数据 422 * @return array 下载有关数据
@@ -418,7 +425,7 @@ class AbstractAction extends Controller_Abstract @@ -418,7 +425,7 @@ class AbstractAction extends Controller_Abstract
418 { 425 {
419 return array( 426 return array(
420 'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480', 427 'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
421 - 'url' => 'http://www.baidu.com' 428 + 'url' => 'http://www.baidu.com'
422 ); 429 );
423 } 430 }
424 431
@@ -442,7 +449,7 @@ class AbstractAction extends Controller_Abstract @@ -442,7 +449,7 @@ class AbstractAction extends Controller_Abstract
442 { 449 {
443 $download = array( 450 $download = array(
444 'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480', 451 'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
445 - 'url' => 'http://www.baidu.com' 452 + 'url' => 'http://www.baidu.com'
446 ); 453 );
447 454
448 $this->_view->assign('headerDownload', $download); 455 $this->_view->assign('headerDownload', $download);
@@ -12,6 +12,8 @@ @@ -12,6 +12,8 @@
12 12
13 namespace Api; 13 namespace Api;
14 14
  15 +use Plugin\Cache;
  16 +
15 class Yohobuy 17 class Yohobuy
16 { 18 {
17 19
@@ -100,11 +102,12 @@ class Yohobuy @@ -100,11 +102,12 @@ class Yohobuy
100 * 102 *
101 * @param string $url 接口URL 103 * @param string $url 接口URL
102 * @param array $data 参数列表 104 * @param array $data 参数列表
  105 + * @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
103 * @param bool $returnJson 控制是否返回json格式数据 106 * @param bool $returnJson 控制是否返回json格式数据
104 * @param int $timeout 超时时间 107 * @param int $timeout 超时时间
105 * @return mixed 108 * @return mixed
106 */ 109 */
107 - public static function get($url, $data = array(), $returnJson = false, $timeout = 5) 110 + public static function get($url, $data = array(), $cache = false, $returnJson = false, $timeout = 5)
108 { 111 {
109 // 销毁私钥参数 112 // 销毁私钥参数
110 if (isset($data['private_key'])) { 113 if (isset($data['private_key'])) {
@@ -114,6 +117,15 @@ class Yohobuy @@ -114,6 +117,15 @@ class Yohobuy
114 $url = self::httpBuildQuery($url, $data); 117 $url = self::httpBuildQuery($url, $data);
115 } 118 }
116 119
  120 + /* 开启缓存的情况 */
  121 + if ($cache) {
  122 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  123 + $result = Cache::get($url, 'master');
  124 + if (!empty($result)) {
  125 + return $result;
  126 + }
  127 + }
  128 +
117 $ch = curl_init($url); 129 $ch = curl_init($url);
118 curl_setopt($ch, CURLOPT_HEADER, 0); 130 curl_setopt($ch, CURLOPT_HEADER, 0);
119 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 131 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@@ -125,6 +137,18 @@ class Yohobuy @@ -125,6 +137,18 @@ class Yohobuy
125 curl_close($ch); 137 curl_close($ch);
126 $data = array(); 138 $data = array();
127 139
  140 + /* 开启缓存的情况 */
  141 + if ($cache) {
  142 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  143 + if (empty($result)) {
  144 + $result = Cache::get($url, 'slave');
  145 + }
  146 + // 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
  147 + else {
  148 + Cache::set($url, $result, $cache);
  149 + }
  150 + }
  151 +
128 return $result; 152 return $result;
129 } 153 }
130 154
@@ -182,12 +206,22 @@ class Yohobuy @@ -182,12 +206,22 @@ class Yohobuy
182 * 206 *
183 * @param array $urlList 接口列表 207 * @param array $urlList 接口列表
184 * @param array $options CURL设置项 208 * @param array $options CURL设置项
185 - * @parma mixed $cache 控制是否启用接口数据的缓存 如3600表示缓存1小时, false表示不缓存 209 + * @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
186 * @param int $timeout 超时时间,单位是秒 210 * @param int $timeout 超时时间,单位是秒
187 * @return array 211 * @return array
188 */ 212 */
189 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)
190 { 214 {
  215 + /* 开启缓存的情况 */
  216 + if ($cache) {
  217 + $key = md5(implode(',', array_values($urlList)));
  218 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  219 + $result = Cache::get($key, 'master');
  220 + if (!empty($result)) {
  221 + return $result;
  222 + }
  223 + }
  224 +
191 $result = array(); 225 $result = array();
192 $response = array(); 226 $response = array();
193 $running = 0; 227 $running = 0;
@@ -256,6 +290,18 @@ class Yohobuy @@ -256,6 +290,18 @@ class Yohobuy
256 } 290 }
257 curl_multi_close($mh); 291 curl_multi_close($mh);
258 292
  293 + /* 开启缓存的情况 */
  294 + if ($cache) {
  295 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  296 + if (empty($result)) {
  297 + $result = Cache::get($key, 'slave');
  298 + }
  299 + // 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
  300 + else {
  301 + Cache::set($key, $result, $cache);
  302 + }
  303 + }
  304 +
259 return $result; 305 return $result;
260 } 306 }
261 307
@@ -263,10 +309,25 @@ class Yohobuy @@ -263,10 +309,25 @@ class Yohobuy
263 * rpc调用远程服务(YAR) 309 * rpc调用远程服务(YAR)
264 * 310 *
265 * @see http://php.net/manual/zh/yar-client.setopt.php 311 * @see http://php.net/manual/zh/yar-client.setopt.php
  312 + * @param string $uri
  313 + * @param string $method
  314 + * @param array $parameters
  315 + * @param mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
  316 + * @param int $timeout
266 * @return array 317 * @return array
267 */ 318 */
268 - public static function yarClient($uri, $method, $parameters = array(), $timeout = 3000) 319 + public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
269 { 320 {
  321 + /* 开启缓存的情况 */
  322 + if ($cache) {
  323 + $key = self::httpBuildQuery($uri . $method, $parameters);
  324 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  325 + $result = Cache::get($key, 'master');
  326 + if (!empty($result)) {
  327 + return $result;
  328 + }
  329 + }
  330 +
270 $client = new \Yar_Client($uri); 331 $client = new \Yar_Client($uri);
271 $client->SetOpt(YAR_OPT_PACKAGER, 'php'); 332 $client->SetOpt(YAR_OPT_PACKAGER, 'php');
272 $client->SetOpt(YAR_OPT_TIMEOUT, $timeout); 333 $client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
@@ -278,6 +339,18 @@ class Yohobuy @@ -278,6 +339,18 @@ class Yohobuy
278 $result = array(); 339 $result = array();
279 } 340 }
280 341
  342 + /* 开启缓存的情况 */
  343 + if ($cache) {
  344 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  345 + if (empty($result)) {
  346 + $result = Cache::get($key, 'slave');
  347 + }
  348 + // 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
  349 + else {
  350 + Cache::set($key, $result, $cache);
  351 + }
  352 + }
  353 +
281 return $result; 354 return $result;
282 } 355 }
283 356
@@ -7,7 +7,12 @@ namespace Configs; @@ -7,7 +7,12 @@ namespace Configs;
7 */ 7 */
8 class CacheConfig 8 class CacheConfig
9 { 9 {
10 -  
11 - const KEY_ACTION_INDEX_INDEX = 'key_action_index_index'; 10 +
  11 + /* 控制器方法中的数据缓存 */
  12 + const KEY_ACTION_INDEX_INDEX = 'key_action_index_index'; // 频道选择
  13 + const KEY_ACTION_BOYS_INDEX = 'key_action_boys_index'; // 男生首页
  14 + const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页
  15 + const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
  16 + const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
12 17
13 } 18 }
@@ -20,21 +20,17 @@ class IndexData @@ -20,21 +20,17 @@ class IndexData
20 /** 20 /**
21 * 获取启动轮播图 21 * 获取启动轮播图
22 * 22 *
  23 + * @param string $contentCode 内容位置码
23 * @return array 轮播图有关数据 24 * @return array 轮播图有关数据
24 */ 25 */
25 - public static function getBannerStart() 26 + public static function getBannerStart($contentCode)
26 { 27 {
27 // 构建必传参数 28 // 构建必传参数
28 $param = Yohobuy::param(); 29 $param = Yohobuy::param();
29 - $param['content_code'] = '7ba9118028f9b22090b57341487567eb'; 30 + $param['content_code'] = $contentCode;
30 $param['client_secret'] = Sign::getSign($param); 31 $param['client_secret'] = Sign::getSign($param);
31 - $response = Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);  
32 32
33 - $result = '';  
34 - if (isset($response['data'][0]['data']['list'][0]['src'])) {  
35 - $result = $response['data'][0]['data']['list'][0]['src'];  
36 - }  
37 - return $result; 33 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
38 } 34 }
39 35
40 /** 36 /**
@@ -53,42 +49,23 @@ class IndexData @@ -53,42 +49,23 @@ class IndexData
53 } 49 }
54 50
55 /** 51 /**
56 - * 获取用户个人信息  
57 - *  
58 - * @param integer $uid 用户ID  
59 - * @return array 用户个人信息数据  
60 - */  
61 - public static function getUserProfile($uid)  
62 - {  
63 - // 构建必传参数  
64 - $param = Yohobuy::param();  
65 - $param['method'] = 'app.passport.profile';  
66 - $param['uid'] = $uid;  
67 - $param['client_secret'] = Sign::getSign($param);  
68 -  
69 - return Yohobuy::get(Yohobuy::API_URL, $param);  
70 - }  
71 -  
72 - /**  
73 * 获取首页频道数据(除了可能喜欢的各楼层有关数据) 52 * 获取首页频道数据(除了可能喜欢的各楼层有关数据)
74 - * @param integer $uid 用户ID  
75 * @param string $gender 用户性别, "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 53 * @param string $gender 用户性别, "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
76 * @param string $contentCode 内容位置码 54 * @param string $contentCode 内容位置码
77 * @param integer $limit 查询返回的最大限字数,默认为20 55 * @param integer $limit 查询返回的最大限字数,默认为20
78 * @param integer $page 分页第几页,默认为第1页 56 * @param integer $page 分页第几页,默认为第1页
79 * @return array 首页频道数据 57 * @return array 首页频道数据
80 */ 58 */
81 - public static function getUserChannelData($uid, $gender, $contentCode, $limit = 20, $page = 1) 59 + public static function getResourceData($gender, $contentCode, $limit = 20, $page = 1)
82 { 60 {
83 $param = Yohobuy::param(); 61 $param = Yohobuy::param();
84 - $param['uid'] = $uid;  
85 $param['gender'] = $gender; 62 $param['gender'] = $gender;
86 $param['content_code'] = $contentCode; 63 $param['content_code'] = $contentCode;
87 $param['page'] = $page; 64 $param['page'] = $page;
88 $param['limit'] = $limit; 65 $param['limit'] = $limit;
89 $param['client_secret'] = Sign::getSign($param); 66 $param['client_secret'] = Sign::getSign($param);
90 -  
91 - return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param); 67 +
  68 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
92 } 69 }
93 70
94 } 71 }
1 <?php 1 <?php
2 2
3 -/*  
4 - * To change this license header, choose License Headers in Project Properties.  
5 - * To change this template file, choose Tools | Templates  
6 - * and open the template in the editor. 3 +namespace LibModels\Wap\Product;
  4 +
  5 +use Api\Sign;
  6 +use Api\Yohobuy;
  7 +
  8 +/**
  9 + * 商品详情相关的数据模型
  10 + *
  11 + * @name DetailData
  12 + * @package LibModels/Wap/Product
  13 + * @copyright yoho.inc
  14 + * @version 1.0 (2015-10-8 11:51:32)
  15 + * @author fei.hong <fei.hong@yoho.cn>
7 */ 16 */
  17 +class DetailData
  18 +{
8 19
  20 +}
@@ -8,7 +8,7 @@ use Api\Yohobuy; @@ -8,7 +8,7 @@ use Api\Yohobuy;
8 /** 8 /**
9 * 商品推荐相关的数据模型 9 * 商品推荐相关的数据模型
10 * 10 *
11 - * @name RecomModel 11 + * @name RecomData
12 * @package LibModels/Wap/Product 12 * @package LibModels/Wap/Product
13 * @copyright yoho.inc 13 * @copyright yoho.inc
14 * @version 1.0 (2015-10-8 11:51:32) 14 * @version 1.0 (2015-10-8 11:51:32)
@@ -33,17 +33,21 @@ class Cache @@ -33,17 +33,21 @@ class Cache
33 * @param int $expire 缓存有效期(单位秒, 0表示永久) 33 * @param int $expire 缓存有效期(单位秒, 0表示永久)
34 * @return void 34 * @return void
35 */ 35 */
36 - public static function set($key, $value, $expire = 3600) 36 + public static function set($key, $value, $expire = 0)
37 { 37 {
38 - // WINDOWS  
39 - if (PATH_SEPARATOR === '\\') {  
40 - HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);  
41 - HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);  
42 - }  
43 - // LINUX  
44 - else {  
45 - HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);  
46 - HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0); 38 + try {
  39 + // WINDOWS
  40 + if (DIRECTORY_SEPARATOR === '\\') {
  41 + HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
  42 + HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);
  43 + }
  44 + // LINUX
  45 + else {
  46 + HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
  47 + HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0);
  48 + }
  49 + } catch (Exception $e) {
  50 + // do nothing
47 } 51 }
48 } 52 }
49 53
@@ -58,13 +62,17 @@ class Cache @@ -58,13 +62,17 @@ class Cache
58 { 62 {
59 $result = array(); 63 $result = array();
60 64
61 - // WINDOWS  
62 - if (PATH_SEPARATOR === '\\') {  
63 - $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));  
64 - }  
65 - // LINUX  
66 - else {  
67 - $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node)); 65 + try {
  66 + // WINDOWS
  67 + if (DIRECTORY_SEPARATOR === '\\') {
  68 + $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
  69 + }
  70 + // LINUX
  71 + else {
  72 + $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
  73 + }
  74 + } catch (Exception $e) {
  75 + $result = array();
68 } 76 }
69 77
70 return $result; 78 return $result;
@@ -79,7 +87,7 @@ class Cache @@ -79,7 +87,7 @@ class Cache
79 public static function delete($key) 87 public static function delete($key)
80 { 88 {
81 // WINDOWS 89 // WINDOWS
82 - if (PATH_SEPARATOR === '\\') { 90 + if (DIRECTORY_SEPARATOR === '\\') {
83 HoodCache::Memcache('master')->delete(self::makeKey($key, 'master')); 91 HoodCache::Memcache('master')->delete(self::makeKey($key, 'master'));
84 HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave')); 92 HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave'));
85 } 93 }
@@ -19,16 +19,17 @@ class FloorProcess @@ -19,16 +19,17 @@ class FloorProcess
19 { 19 {
20 $result = array(); 20 $result = array();
21 if (!empty($data['list'])) { 21 if (!empty($data['list'])) {
  22 + $build = array();
22 foreach ($data['list'] as $v) { 23 foreach ($data['list'] as $v) {
23 $fun = $v['template_name']; 24 $fun = $v['template_name'];
24 if (!is_callable("self::$fun")) { 25 if (!is_callable("self::$fun")) {
25 continue; 26 continue;
26 } 27 }
27 - $data = self::$fun($v['data'], $type);  
28 - if (empty($data)) { 28 + $build = self::$fun($v['data'], $type);
  29 + if (empty($build)) {
29 continue; 30 continue;
30 } 31 }
31 - $result[] = $data; 32 + $result[] = $build;
32 } 33 }
33 } 34 }
34 return $result; 35 return $result;
@@ -83,6 +84,7 @@ class FloorProcess @@ -83,6 +84,7 @@ class FloorProcess
83 if (empty($data)) { 84 if (empty($data)) {
84 return array(); 85 return array();
85 } 86 }
  87 +
86 foreach ($data as &$one) { 88 foreach ($data as &$one) {
87 $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1); 89 $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
88 unset($one['src']); 90 unset($one['src']);
@@ -257,7 +259,6 @@ class FloorProcess @@ -257,7 +259,6 @@ class FloorProcess
257 */ 259 */
258 private static function single_name_image($data, $type) 260 private static function single_name_image($data, $type)
259 { 261 {
260 -  
261 if (empty($data)) { 262 if (empty($data)) {
262 return array(); 263 return array();
263 } 264 }
  1 +server
  2 +{
  3 + listen 80;
  4 + server_name wap.yohobuy.com;
  5 +
  6 + #access_log /Data/logs/access.wap.yohobuy.com.log combined;
  7 + error_log /Data/logs/error.wap.yohobuy.com.log warn;
  8 +
  9 + root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
  10 +
  11 + location ~* \.html$ {
  12 + root /Data/PE/yohobuy/assets;
  13 + if (!-f $request_filename){
  14 + root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;
  15 + rewrite ^/(.+)$ /index.php?$1& last;
  16 + }
  17 + expires 7d;
  18 + }
  19 +
  20 + location / {
  21 + index index.php;
  22 + if (!-f $request_filename){
  23 + rewrite ^/(.+)$ /index.php?$1& last;
  24 + }
  25 + }
  26 +
  27 + location ~* \.(ico|woff)$ {
  28 + expires 7d;
  29 + }
  30 +
  31 + location = /crossdomain.xml {
  32 + expires 7d;
  33 + }
  34 +
  35 + location ~ .*\.php?$ {
  36 + fastcgi_pass 127.0.0.1:9000;
  37 + fastcgi_index index.php;
  38 + #fastcgi_param PATH_INFO $fastcgi_script_name;
  39 + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  40 + include fastcgi_params;
  41 + }
  42 +
  43 + error_page 403 = http://wap.yohobuy.com;
  44 + error_page 404 = http://wap.yohobuy.com/error.html;
  45 +}
  46 +
  47 +server
  48 +{
  49 + listen 80;
  50 + server_name static.wap.yohobuy.com;
  51 +
  52 + #access_log /Data/logs/access.static.wap.yohobuy.com.log combined;
  53 + #error_log /Data/logs/error.static.wap.yohobuy.com.log warn;
  54 +
  55 + root /Data/PE/yohobuy/static;
  56 +
  57 + location / {
  58 + log_not_found off;
  59 + access_log off;
  60 + expires 30d;
  61 + }
  62 +
  63 + location ~* \.(svg|eot|ttf|woff|otf)$ {
  64 + add_header Access-Control-Allow-Origin *;
  65 + expires 30d;
  66 + }
  67 +
  68 +}
This diff could not be displayed because it is too large.

6.5 KB | W: | H:

9.08 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +/**
  2 + * 分类
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/14
  5 + */
  6 +
  7 +var $ = require('yoho.zepto'),
  8 + Swiper = require('yoho.iswiper'),
  9 + lazyLoad = require('yoho.zeptolazyload');
  10 +
  11 +var swiper;
  12 +
  13 +swiper = new Swiper('.swiper-container', {
  14 + lazyLoading: true,
  15 + loop: true,
  16 + autoplay: 3000,
  17 + pagination: '.swiper-pagination'
  18 +});
  19 +
  20 +lazyLoad($('img.lazy'));
1 -/**  
2 - * 男首  
3 - * @author: liangzhifeng<zhifeng.liang@yoho.cn>  
4 - * @date: 2015/10/12  
5 - */  
6 - var $ = require('yoho.zepto'),  
7 - lazyLoad = require('yoho.zeptolazyload');  
8 -  
9 -//Init LazyLoad  
10 -lazyLoad($('img.lazy'));  
@@ -2,4 +2,4 @@ @@ -2,4 +2,4 @@
2 * 频道选择 2 * 频道选择
3 * @author: liangzhifeng<zhifeng.liang@yoho.cn> 3 * @author: liangzhifeng<zhifeng.liang@yoho.cn>
4 * @date: 2015/10/12 4 * @date: 2015/10/12
5 - */  
  5 + */
@@ -4,4 +4,5 @@ @@ -4,4 +4,5 @@
4 * @date: 2015/10/19 4 * @date: 2015/10/19
5 */ 5 */
6 6
7 -require('./search');  
  7 +require('./search');
  8 +require('./channel');
@@ -16,6 +16,7 @@ var winH = $(window).height(), @@ -16,6 +16,7 @@ var winH = $(window).height(),
16 index = 0, 16 index = 0,
17 num; 17 num;
18 18
  19 +
19 var swiper; 20 var swiper;
20 21
21 swiper = new Swiper('.swiper-container', { 22 swiper = new Swiper('.swiper-container', {
  1 +.brand-page {
  2 +
  3 + .hot-brand {
  4 + margin: (30rem / $pxConvertRem) 0 0;
  5 +
  6 + .hot-brand-list {
  7 + background: #fff;
  8 + li {
  9 + float: left;
  10 + width: 158rem / $pxConvertRem;
  11 + height: 158rem / $pxConvertRem;
  12 +
  13 + .img-box {
  14 + width: 100%;
  15 + height: 100%;
  16 +
  17 + }
  18 + }
  19 + }
  20 + }
  21 +
  22 + .brand-list {
  23 + width: 100%;
  24 +
  25 + .title-bar {
  26 + width: 100%;
  27 + background: #eeeeee;
  28 +
  29 + color: #999999;
  30 + font-weight: bold;
  31 + position: relative;
  32 +
  33 + h2 {
  34 + width: 100%;
  35 + height: 25px;
  36 + line-height: 25px;
  37 + font-size: 17px;
  38 + border-top: 1px solid #e6e6e6;
  39 + background-color: #f4f4f4;
  40 + }
  41 + }
  42 +
  43 + p {
  44 + cursor: pointer;
  45 + height: 25px;
  46 + padding-right: 10px;
  47 + a {
  48 + display: block;
  49 + font-size: 17px;
  50 + border-bottom: 1px solid #f3f3f3;
  51 + border-top: 1px solid #f9f9f9;
  52 + i {
  53 + position: relative;
  54 + top: 1px;
  55 + color: #ff0000;
  56 + padding-left: 16px;
  57 + }
  58 + }
  59 + }
  60 + }
  61 +
  62 + .right-bar {
  63 +
  64 + width: 30px;
  65 + top: 120px !important;
  66 + overflow: hidden;
  67 + position: fixed;
  68 + right: 1px;
  69 + border-radius: 6px;
  70 + background: rgba(0,0,0,.8);
  71 + b {
  72 + height: 16px;
  73 +
  74 + line-height: 14px;
  75 + text-align: center;
  76 + display: block;
  77 + color: #999999;
  78 + font-weight: bold;
  79 + }
  80 + }
  81 +
  82 + .con {
  83 + padding-top: 5px;
  84 + }
  85 +
  86 +}
  1 +.hot-category {
  2 + margin: (30rem / $pxConvertRem) 0 0;
  3 + border-top: 1px solid #e0e0e0;
  4 + .category-banner {
  5 + height: 198rem / $pxConvertRem;
  6 + img {
  7 + display: block;
  8 + width: 100%;
  9 + height: 100%;
  10 + }
  11 + }
  12 + .category-list {
  13 + background: #fff;
  14 + border-top: 1px solid #e0e0e0;
  15 + li {
  16 + float: left;
  17 + width: 158rem / $pxConvertRem;
  18 + height: 174rem / $pxConvertRem;
  19 + border-bottom: 1px solid #e0e0e0;
  20 + border-left: 1px solid #e0e0e0;
  21 + .img-box {
  22 + width: 100%;
  23 + height: 138rem / $pxConvertRem;
  24 + text-align: center;
  25 + vertical-align: middle;
  26 + img {
  27 + max-width: 100%;
  28 + max-height: 100%;
  29 + vertical-align: middle;
  30 + }
  31 + }
  32 +
  33 + }
  34 + }
  35 +}
@@ -29,12 +29,7 @@ @@ -29,12 +29,7 @@
29 vertical-align: middle; 29 vertical-align: middle;
30 } 30 }
31 } 31 }
32 - .category-title {  
33 - line-height: 22rem / $pxConvertRem;  
34 - color: #aaa;  
35 - font-size: 18rem / $pxConvertRem;  
36 - text-align: center;  
37 - } 32 +
38 } 33 }
39 } 34 }
40 } 35 }
@@ -92,4 +92,4 @@ a { @@ -92,4 +92,4 @@ a {
92 @include border-radius(10px); 92 @include border-radius(10px);
93 } 93 }
94 94
95 -@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index";  
  95 +@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index","category/brand", "product/index", "index/index";
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 {{/ bannerTop}} 5 {{/ bannerTop}}
6 6
7 {{# hotBrand}} 7 {{# hotBrand}}
8 - <div class="hot-category">  
9 - <ul class="category-list clearfix"> 8 + <div class="hot-brand">
  9 + <ul class="hot-brand-list clearfix">
10 {{# list}} 10 {{# list}}
11 <li> 11 <li>
12 <a href="{{url}}"> 12 <a href="{{url}}">
@@ -42,6 +42,37 @@ @@ -42,6 +42,37 @@
42 </div> 42 </div>
43 {{/ brandList}} 43 {{/ brandList}}
44 44
  45 + <div id="right-bar" class="right-bar">
  46 + <div class="con" id="con">
  47 + <b>#</b>
  48 + <b>A</b>
  49 + <b>B</b>
  50 + <b>C</b>
  51 + <b>D</b>
  52 + <b>E</b>
  53 + <b>F</b>
  54 + <b>G</b>
  55 + <b>H</b>
  56 + <b>I</b>
  57 + <b>J</b>
  58 + <b>K</b>
  59 + <b>L</b>
  60 + <b>M</b>
  61 + <b>N</b>
  62 + <b>O</b>
  63 + <b>P</b>
  64 + <b>Q</b>
  65 + <b>R</b>
  66 + <b>S</b>
  67 + <b>T</b>
  68 + <b>U</b>
  69 + <b>V</b>
  70 + <b>W</b>
  71 + <b>X</b>
  72 + <b>Y</b>
  73 + <b>Z</b>
  74 + </div>
  75 + </div>
45 76
46 </div> 77 </div>
47 {{> layout/footer}} 78 {{> layout/footer}}
@@ -123,6 +123,12 @@ @@ -123,6 +123,12 @@
123 seajs.use('js/category/index'); 123 seajs.use('js/category/index');
124 </script> 124 </script>
125 {{/if}} 125 {{/if}}
  126 +{{!-- 品牌 --}}
  127 +{{#if brandPage}}
  128 + <script>
  129 + seajs.use('js/category/brand');
  130 + </script>
  131 +{{/if}}
126 132
127 {{!-- 搜索 --}} 133 {{!-- 搜索 --}}
128 {{#if searchPage}} 134 {{#if searchPage}}
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use LibModels\Wap\Home\IndexData;  
5 -use Plugin\DataProcess\FloorProcess;  
6 4
7 /** 5 /**
8 * 男生首页 6 * 男生首页
@@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess; @@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
10 class BoysController extends AbstractAction 8 class BoysController extends AbstractAction
11 { 9 {
12 10
  11 + /**
  12 + * 男生首页
  13 + */
13 public function indexAction() 14 public function indexAction()
14 { 15 {
15 // 设置网站标题 16 // 设置网站标题
@@ -19,18 +20,13 @@ class BoysController extends AbstractAction @@ -19,18 +20,13 @@ class BoysController extends AbstractAction
19 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
20 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
21 22
22 - $data = array('boysHomePage' => true);  
23 - $uid = $this->getUid();  
24 -  
25 - // 频道数据  
26 - $channelData = IndexData::getUserChannelData($uid, '1,3', '201504091403001');  
27 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
28 - $data['content'] = FloorProcess::getContent($channelData['data']);  
29 - } 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'boysHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getBoysFloor()
  28 + ));
30 29
31 - $data['maybeLike'] = true;  
32 -  
33 - $this->_view->display('index', $data);  
34 } 30 }
35 31
36 } 32 }
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use LibModels\Wap\Home\IndexData;  
5 -use Plugin\DataProcess\FloorProcess;  
6 4
7 /** 5 /**
8 * 女生首页 6 * 女生首页
@@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess; @@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
10 class GirlsController extends AbstractAction 8 class GirlsController extends AbstractAction
11 { 9 {
12 10
  11 + /**
  12 + * 女生首页
  13 + */
13 public function indexAction() 14 public function indexAction()
14 { 15 {
15 // 设置网站标题 16 // 设置网站标题
@@ -19,16 +20,13 @@ class GirlsController extends AbstractAction @@ -19,16 +20,13 @@ class GirlsController extends AbstractAction
19 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
20 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
21 22
22 - $data = array('grilsHomePage' => true);  
23 - $uid = $this->getUid();  
24 -  
25 - // 频道数据  
26 - $channelData = IndexData::getUserChannelData($uid, '2,3', '201504091403002');  
27 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
28 - $data['content'] = FloorProcess::getContent($channelData['data'], 2);  
29 - }  
30 -  
31 - $this->_view->display('index', $data); 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'grilsHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getGirlsFloor()
  28 + ));
  29 +
32 } 30 }
33 31
34 } 32 }
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use LibModels\Wap\Home\IndexData;  
5 -use Plugin\Helpers;  
6 4
7 /** 5 /**
8 * 频道选择 6 * 频道选择
@@ -11,24 +9,13 @@ class IndexController extends AbstractAction @@ -11,24 +9,13 @@ class IndexController extends AbstractAction
11 { 9 {
12 10
13 /** 11 /**
14 - * 启动首页频道选择 12 + * 频道选择页
15 */ 13 */
16 public function indexAction() 14 public function indexAction()
17 { 15 {
18 - // 背景图获取  
19 - $banner = IndexData::getBannerStart();  
20 - if ($banner) {  
21 - $data['background'] = Helpers::getImageUrl($banner, 640, 800, 1);  
22 - }  
23 -  
24 - // 设置底部导航信息  
25 - $this->setNavFooter();  
26 -  
27 - // 生成HTML (index.html)  
28 - $this->_view->html('index');  
29 -  
30 - // 渲染模板  
31 - $this->_view->display('index', $data); 16 + $this->_view->display('index', array(
  17 + 'background' => Index\HomeModel::getBgImage()
  18 + ));
32 } 19 }
33 20
34 } 21 }
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use LibModels\Wap\Home\IndexData;  
5 -use Plugin\DataProcess\FloorProcess;  
6 4
7 /** 5 /**
8 * 儿童首页 6 * 儿童首页
@@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess; @@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
10 class KidsController extends AbstractAction 8 class KidsController extends AbstractAction
11 { 9 {
12 10
  11 + /**
  12 + * 潮童首页
  13 + */
13 public function indexAction() 14 public function indexAction()
14 { 15 {
15 // 设置网站标题 16 // 设置网站标题
@@ -19,18 +20,13 @@ class KidsController extends AbstractAction @@ -19,18 +20,13 @@ class KidsController extends AbstractAction
19 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
20 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
21 22
22 - $data = array('kidsHomePage' => true);  
23 - $uid = $this->getUid();  
24 -  
25 - // 频道数据  
26 - $channelData = IndexData::getUserChannelData($uid, '', 'e9875682c1599a886bfbdb965b740022');  
27 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
28 - $data['content'] = FloorProcess::getContent($channelData['data'], 3);  
29 - }  
30 -  
31 - $data['maybeLike'] = true; 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'kidsHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getKidsFloor()
  28 + ));
32 29
33 - $this->_view->display('index', $data);  
34 } 30 }
35 31
36 } 32 }
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use LibModels\Wap\Home\IndexData;  
5 -use Plugin\DataProcess\FloorProcess;  
6 4
7 /** 5 /**
8 * 创意生活首页 6 * 创意生活首页
@@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess; @@ -10,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
10 class LifestyleController extends AbstractAction 8 class LifestyleController extends AbstractAction
11 { 9 {
12 10
  11 + /**
  12 + * 创意生活首页
  13 + */
13 public function indexAction() 14 public function indexAction()
14 { 15 {
15 // 设置网站标题 16 // 设置网站标题
@@ -19,18 +20,13 @@ class LifestyleController extends AbstractAction @@ -19,18 +20,13 @@ class LifestyleController extends AbstractAction
19 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
20 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
21 22
22 - $data = array('lifestyleHomePage' => true);  
23 - $uid = $this->getUid();  
24 -  
25 - // 频道数据  
26 - $channelData = IndexData::getUserChannelData($uid, '', '9aa25f5133f011ec96c2045eb15ae425');  
27 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
28 - $data['content'] = FloorProcess::getContent($channelData['data'], 4);  
29 - } 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'lifestyleHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getLifestyleFloor()
  28 + ));
30 29
31 - $data['maybeLike'] = true;  
32 -  
33 - $this->_view->display('index', $data);  
34 } 30 }
35 31
36 } 32 }
  1 +<?php
  2 +
  3 +namespace Index;
  4 +
  5 +use LibModels\Wap\Home\IndexData;
  6 +use Plugin\Helpers;
  7 +use Plugin\Cache;
  8 +use Plugin\DataProcess\FloorProcess;
  9 +use Configs\CacheConfig;
  10 +
  11 +/**
  12 + * 首页相关的模板数据模型
  13 + *
  14 + * @name HomeModel
  15 + * @package models
  16 + * @copyright yoho.inc
  17 + * @version 1.0 (2015-10-21 11:08:21)
  18 + * @author fei.hong <fei.hong@yoho.cn>
  19 + */
  20 +class HomeModel
  21 +{
  22 +
  23 + /* 频道选择页取背景图片的位置码 */
  24 + const CODE_BG = '7ba9118028f9b22090b57341487567eb';
  25 +
  26 + /* 男生楼层资源的位置码 */
  27 + const CODE_FLOOR_BOYS = '8512bf0755cc549ac323f852c9fd945d';
  28 + /* 女生楼层资源的位置码 */
  29 + const CODE_FLOOR_GIRLS = '189b6686065dbd6755dd6906cf03c002';
  30 + /* 潮童楼层资源的位置码 */
  31 + const CODE_FLOOR_KIDS = '66cad79d93e055ad6fc5c8744086066d'; // 'b8c1bff53d4ea60f978926d538620636';
  32 + /* 创意生活楼层资源的位置码 */
  33 + const CODE_FLOOR_LIFESTYLE = '61cd852c6afcf60660196154f66a3a62';
  34 +
  35 + /* 男生底部广告的位置码 */
  36 + const CODE_BANNER_BOTTOM_BOYS = 'a2ec977c027d0cd9cdccb356ddf16b08';
  37 + /* 女生底部广告的位置码 */
  38 + const CODE_BANNER_BOTTOM_GIRLS = '8c8bd1b89a22e5895f05882e0825b493';
  39 +
  40 + /**
  41 + * 获取频道选择页的背景图片
  42 + *
  43 + * @return string | false
  44 + */
  45 + public static function getBgImage()
  46 + {
  47 + if (USE_CACHE) {
  48 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  49 + $result = Cache::get(CacheConfig::KEY_ACTION_INDEX_INDEX, 'master');
  50 + if (!empty($result)) {
  51 + return $result;
  52 + }
  53 + }
  54 +
  55 + // 调用接口获取数据
  56 + $banner = IndexData::getBannerStart(self::CODE_BG);
  57 + if (isset($banner['data'][0]['data']['list'][0]['src'])) {
  58 + $result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 1);
  59 + } else {
  60 + $result = false;
  61 + }
  62 +
  63 + if (USE_CACHE) {
  64 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  65 + if (empty($result)) {
  66 + $result = Cache::get(CacheConfig::KEY_ACTION_INDEX_INDEX, 'slave');
  67 + }
  68 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  69 + else {
  70 + Cache::set(CacheConfig::KEY_ACTION_INDEX_INDEX, $result);
  71 + }
  72 + }
  73 +
  74 + return $result;
  75 + }
  76 +
  77 + /**
  78 + * 获取男生首页的楼层数据
  79 + */
  80 + public static function getBoysFloor()
  81 + {
  82 + if (USE_CACHE) {
  83 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  84 + $result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'master');
  85 + if (!empty($result)) {
  86 + return $result;
  87 + }
  88 + }
  89 +
  90 + // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
  91 + $channelData = IndexData::getResourceData('1,3', self::CODE_FLOOR_BOYS);
  92 + if (isset($channelData['code']) && $channelData['code'] == 200) {
  93 + $result = FloorProcess::getContent($channelData['data']);
  94 + }
  95 +
  96 + if (USE_CACHE) {
  97 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  98 + if (empty($result)) {
  99 + $result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'slave');
  100 + }
  101 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  102 + else {
  103 + Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result);
  104 + }
  105 + }
  106 +
  107 + return $result;
  108 + }
  109 +
  110 + /**
  111 + * 获取女生首页的楼层数据
  112 + */
  113 + public static function getGirlsFloor()
  114 + {
  115 + if (USE_CACHE) {
  116 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  117 + $result = Cache::get(CacheConfig::KEY_ACTION_GIRLS_INDEX, 'master');
  118 + if (!empty($result)) {
  119 + return $result;
  120 + }
  121 + }
  122 +
  123 + // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
  124 + $channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS);
  125 + if (isset($channelData['code']) && $channelData['code'] == 200) {
  126 + $result = FloorProcess::getContent($channelData['data']);
  127 + }
  128 +
  129 + if (USE_CACHE) {
  130 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  131 + if (empty($result)) {
  132 + $result = Cache::get(CacheConfig::KEY_ACTION_GIRLS_INDEX, 'slave');
  133 + }
  134 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  135 + else {
  136 + Cache::set(CacheConfig::KEY_ACTION_GIRLS_INDEX, $result);
  137 + }
  138 + }
  139 +
  140 + return $result;
  141 + }
  142 +
  143 + /**
  144 + * 获取潮童首页的楼层数据
  145 + */
  146 + public static function getKidsFloor()
  147 + {
  148 + if (USE_CACHE) {
  149 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  150 + $result = Cache::get(CacheConfig::KEY_ACTION_KIDS_INDEX, 'master');
  151 + if (!empty($result)) {
  152 + return $result;
  153 + }
  154 + }
  155 +
  156 + // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
  157 + $channelData = IndexData::getResourceData('', self::CODE_FLOOR_KIDS);
  158 + if (isset($channelData['code']) && $channelData['code'] == 200) {
  159 + $result = FloorProcess::getContent($channelData['data'], 3);
  160 + }
  161 +
  162 + if (USE_CACHE) {
  163 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  164 + if (empty($result)) {
  165 + $result = Cache::get(CacheConfig::KEY_ACTION_KIDS_INDEX, 'slave');
  166 + }
  167 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  168 + else {
  169 + Cache::set(CacheConfig::KEY_ACTION_KIDS_INDEX, $result);
  170 + }
  171 + }
  172 +
  173 + return $result;
  174 + }
  175 +
  176 + /**
  177 + * 获取创意生活首页的楼层数据
  178 + */
  179 + public static function getLifestyleFloor()
  180 + {
  181 + if (USE_CACHE) {
  182 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  183 + $result = Cache::get(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, 'master');
  184 + if (!empty($result)) {
  185 + return $result;
  186 + }
  187 + }
  188 +
  189 + // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
  190 + $channelData = IndexData::getResourceData('', self::CODE_FLOOR_LIFESTYLE);
  191 + if (isset($channelData['code']) && $channelData['code'] == 200) {
  192 + $result = FloorProcess::getContent($channelData['data'], 4);
  193 + }
  194 +
  195 + if (USE_CACHE) {
  196 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  197 + if (empty($result)) {
  198 + $result = Cache::get(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, 'slave');
  199 + }
  200 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  201 + else {
  202 + Cache::set(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, $result);
  203 + }
  204 + }
  205 +
  206 + return $result;
  207 + }
  208 +
  209 +}
@@ -28,19 +28,20 @@ class BrandController extends AbstractAction @@ -28,19 +28,20 @@ class BrandController extends AbstractAction
28 var_dump($brandTop, $brands);exit;*/ 28 var_dump($brandTop, $brands);exit;*/
29 29
30 $data = array ( 30 $data = array (
  31 + 'brandPage' => true,
31 'bannerTop' => array ( 32 'bannerTop' => array (
32 'list' => array ( 33 'list' => array (
33 array ( 34 array (
34 'url' => '', 35 'url' => '',
35 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg' 36 + 'img' => 'http://img10.static.yhbimg.com/adpic/2015/10/15/10/01c161398d3baec2868abe85e26ba1a71d.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
36 ), 37 ),
37 array ( 38 array (
38 'url' => '', 39 'url' => '',
39 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg' 40 + 'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/027c45cdc03e23c367ec0ff3d29b7c3f79.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
40 ), 41 ),
41 array ( 42 array (
42 'url' => '', 43 'url' => '',
43 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg' 44 + 'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
44 ) 45 )
45 ) 46 )
46 ), 47 ),
@@ -48,43 +49,35 @@ class BrandController extends AbstractAction @@ -48,43 +49,35 @@ class BrandController extends AbstractAction
48 'list' => array ( 49 'list' => array (
49 array ( 50 array (
50 'url' => '', 51 'url' => '',
51 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
52 - 'name' => '手表' 52 + 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/08/12/17/0233d54f34d2534c08271a8fc27090a6af.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
53 ), 53 ),
54 array ( 54 array (
55 'url' => '', 55 'url' => '',
56 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
57 - 'name' => '烛台' 56 + 'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/020b17265b2103b49005c57395b8b154a9.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
58 ), 57 ),
59 array ( 58 array (
60 'url' => '', 59 'url' => '',
61 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
62 - 'name' => '烛台' 60 + 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/11/27/09/02b403bdcbfb965bdc632fea5c29816746.png?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
63 ), 61 ),
64 array ( 62 array (
65 'url' => '', 63 'url' => '',
66 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
67 - 'name' => '烛台' 64 + 'img' => 'http://img13.static.yhbimg.com/brandLogo/2013/11/01/14/027e68260ba30c01b165c17fe043f2ce2c.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
68 ), 65 ),
69 array ( 66 array (
70 'url' => '', 67 'url' => '',
71 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
72 - 'name' => '烛台' 68 + 'img' => 'http://img11.static.yhbimg.com/brandLogo/2014/04/25/14/0179fa8eacf51fd1a89ec6f7fdeab88fc2.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
73 ), 69 ),
74 array ( 70 array (
75 'url' => '', 71 'url' => '',
76 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
77 - 'name' => '烛台' 72 + 'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/02608437f8d8b6b7b15786214b0a5ef502.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
78 ), 73 ),
79 array ( 74 array (
80 'url' => '', 75 'url' => '',
81 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
82 - 'name' => '烛台' 76 + 'img' => 'http://img12.static.yhbimg.com/brandLogo/2013/02/28/17/020aae69720d683a7962c9b7fd3a92c801.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
83 ), 77 ),
84 array ( 78 array (
85 'url' => '', 79 'url' => '',
86 - 'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',  
87 - 'name' => '烛台' 80 + 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
88 ) 81 )
89 ) 82 )
90 ), 83 ),
@@ -134,6 +127,104 @@ class BrandController extends AbstractAction @@ -134,6 +127,104 @@ class BrandController extends AbstractAction
134 'name' => 'Bcrwewwe' 127 'name' => 'Bcrwewwe'
135 ) 128 )
136 ) 129 )
  130 + ),
  131 + array (
  132 + 'title' => 'B',
  133 + 'list' => array(
  134 + array (
  135 + 'name' => 'Bape'
  136 + ),
  137 + array (
  138 + 'name' => 'Bdfdfd'
  139 + ),
  140 + array (
  141 + 'name' => 'Bcrwewwe'
  142 + )
  143 + )
  144 + ),
  145 + array (
  146 + 'title' => 'B',
  147 + 'list' => array(
  148 + array (
  149 + 'name' => 'Bape'
  150 + ),
  151 + array (
  152 + 'name' => 'Bdfdfd'
  153 + ),
  154 + array (
  155 + 'name' => 'Bcrwewwe'
  156 + )
  157 + )
  158 + ),
  159 + array (
  160 + 'title' => 'B',
  161 + 'list' => array(
  162 + array (
  163 + 'name' => 'Bape'
  164 + ),
  165 + array (
  166 + 'name' => 'Bdfdfd'
  167 + ),
  168 + array (
  169 + 'name' => 'Bcrwewwe'
  170 + )
  171 + )
  172 + ),
  173 + array (
  174 + 'title' => 'B',
  175 + 'list' => array(
  176 + array (
  177 + 'name' => 'Bape'
  178 + ),
  179 + array (
  180 + 'name' => 'Bdfdfd'
  181 + ),
  182 + array (
  183 + 'name' => 'Bcrwewwe'
  184 + )
  185 + )
  186 + ),
  187 + array (
  188 + 'title' => 'B',
  189 + 'list' => array(
  190 + array (
  191 + 'name' => 'Bape'
  192 + ),
  193 + array (
  194 + 'name' => 'Bdfdfd'
  195 + ),
  196 + array (
  197 + 'name' => 'Bcrwewwe'
  198 + )
  199 + )
  200 + ),
  201 + array (
  202 + 'title' => 'B',
  203 + 'list' => array(
  204 + array (
  205 + 'name' => 'Bape'
  206 + ),
  207 + array (
  208 + 'name' => 'Bdfdfd'
  209 + ),
  210 + array (
  211 + 'name' => 'Bcrwewwe'
  212 + )
  213 + )
  214 + ),
  215 + array (
  216 + 'title' => 'B',
  217 + 'list' => array(
  218 + array (
  219 + 'name' => 'Bape'
  220 + ),
  221 + array (
  222 + 'name' => 'Bdfdfd'
  223 + ),
  224 + array (
  225 + 'name' => 'Bcrwewwe'
  226 + )
  227 + )
137 ) 228 )
138 ) 229 )
139 230
1 -[common]  
2 -servers.host = 127.0.0.1:11211:90  
3 -[memcached:common]  
4 -servers.hosts = 127.0.0.1:11213 1 +[memcached]
  2 +master.hosts = 127.0.0.1:11212,127.0.0.1:11213
  3 +slave.hosts = 127.0.0.1:11212,127.0.0.1:11213
5 [redis] 4 [redis]
6 servers.hosts = 127.0.0.1:6379 5 servers.hosts = 127.0.0.1:6379
@@ -5,7 +5,7 @@ collation = utf8_unicode_ci @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
5 timeout = 3 5 timeout = 3
6 6
7 [database] 7 [database]
8 -yhb_bill.username = yohodb  
9 -yhb_bill.passwd = yohonj_9646_mysql  
10 -yhb_bill.write = 123.56.86.219:5511  
11 -yhb_bill.read = 123.56.86.219:5511  
  8 +yhb_test.username = test
  9 +yhb_test.passwd = 123456
  10 +yhb_test.write = 127.0.0.1:5511
  11 +yhb_test.read = 127.0.0.1:5511
@@ -5,7 +5,7 @@ collation = utf8_unicode_ci @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
5 timeout = 3 5 timeout = 3
6 6
7 [database] 7 [database]
8 -yhb_bill.username = yohodb  
9 -yhb_bill.passwd = yohonj_9646_mysql  
10 -yhb_bill.write = 123.56.86.219:5511  
11 -yhb_bill.read = 123.56.86.219:5511  
  8 +yhb_test.username = test
  9 +yhb_test.passwd = 123456
  10 +yhb_test.write = 127.0.0.1:5511
  11 +yhb_test.read = 127.0.0.1:5511
@@ -5,7 +5,7 @@ collation = utf8_unicode_ci @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
5 timeout = 3 5 timeout = 3
6 6
7 [database] 7 [database]
8 -yhb_bill.username = yohodb  
9 -yhb_bill.passwd = yohonj_9646_mysql  
10 -yhb_bill.write = 10.170.183.158:5511  
11 -yhb_bill.read = 10.170.183.158:5511  
  8 +yhb_test.username = test
  9 +yhb_test.passwd = 123456
  10 +yhb_test.write = 127.0.0.1:5511
  11 +yhb_test.read = 127.0.0.1:5511
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
  4 +define('SITE_DOMAIN', 'm.dev.yohobuy.com'); // 网站主域名
  5 +define('USE_CACHE', false); // 缓存的开关
4 define('APPLICATION_PATH', dirname(__DIR__)); 6 define('APPLICATION_PATH', dirname(__DIR__));
5 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 7 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
6 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); 8 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
  4 +define('SITE_DOMAIN', 'buy.test.yoho.cn'); // 网站主域名
  5 +define('USE_CACHE', true); // 缓存的开关
4 define('APPLICATION_PATH', dirname(__DIR__)); 6 define('APPLICATION_PATH', dirname(__DIR__));
5 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 7 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
6 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing'); 8 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing');
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
  4 +define('SITE_DOMAIN', 'wap.yohobuy.com'); // 网站主域名
  5 +define('USE_CACHE', true); // 缓存的开关
4 define('APPLICATION_PATH', dirname(__DIR__)); 6 define('APPLICATION_PATH', dirname(__DIR__));
5 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); 7 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
6 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production'); 8 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');