Authored by xuqi

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

Showing 43 changed files with 924 additions and 251 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 ### 侧栏导航
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 * 所有Controller控制器的基类 4 * 所有Controller控制器的基类
5 * 5 *
6 * @name AbstractAction 6 * @name AbstractAction
7 - * @package 7 + * @package library
8 * @copyright yoho.inc 8 * @copyright yoho.inc
9 * @version 1.0 (2015-9-15 11:55:25) 9 * @version 1.0 (2015-9-15 11:55:25)
10 * @author fei.hong <fei.hong@yoho.cn> 10 * @author fei.hong <fei.hong@yoho.cn>
@@ -27,6 +27,19 @@ class AbstractAction extends Controller_Abstract @@ -27,6 +27,19 @@ class AbstractAction extends Controller_Abstract
27 protected $_request; 27 protected $_request;
28 28
29 /** 29 /**
  30 + * 用户相关信息
  31 + */
  32 + protected $_uid = 0;
  33 + protected $_uname = '';
  34 +
  35 + /**
  36 + * 存放模板数据
  37 + *
  38 + * @var array
  39 + */
  40 + protected $_data;
  41 +
  42 + /**
30 * 初始化 43 * 初始化
31 */ 44 */
32 public function init() 45 public function init()
@@ -35,13 +48,13 @@ class AbstractAction extends Controller_Abstract @@ -35,13 +48,13 @@ class AbstractAction extends Controller_Abstract
35 48
36 // 设置环境变量 49 // 设置环境变量
37 switch (APPLICATION_ENV) { 50 switch (APPLICATION_ENV) {
38 - case 'production': 51 + case 'production': // 生产
39 $this->_view->assign('rlsEnv', true); 52 $this->_view->assign('rlsEnv', true);
40 break; 53 break;
41 - case 'testing': 54 + case 'testing': // 测试
42 $this->_view->assign('testEnv', true); 55 $this->_view->assign('testEnv', true);
43 break; 56 break;
44 - case 'develop': 57 + case 'develop': // 开发
45 default: 58 default:
46 $this->_view->assign('devEnv', true); 59 $this->_view->assign('devEnv', true);
47 break; 60 break;
@@ -144,7 +157,7 @@ class AbstractAction extends Controller_Abstract @@ -144,7 +157,7 @@ class AbstractAction extends Controller_Abstract
144 * @param integer $path cookie可用的路径 157 * @param integer $path cookie可用的路径
145 * @param string $domain cookie可用域名 158 * @param string $domain cookie可用域名
146 */ 159 */
147 - protected function setCookie($name, $value, $expire = 0, $path = '/',$domain = 'yohobuy.com') 160 + protected function setCookie($name, $value, $expire = 0, $path = '/', $domain = '.yohobuy.com')
148 { 161 {
149 setcookie($name, $value, $expire, $path, $domain); 162 setcookie($name, $value, $expire, $path, $domain);
150 } 163 }
@@ -158,7 +171,7 @@ class AbstractAction extends Controller_Abstract @@ -158,7 +171,7 @@ class AbstractAction extends Controller_Abstract
158 */ 171 */
159 protected function getCookie($name, $default = '') 172 protected function getCookie($name, $default = '')
160 { 173 {
161 - return $this->request->getCookie($name, $default); 174 + return $this->_request->getCookie($name, $default);
162 } 175 }
163 176
164 /** 177 /**
@@ -198,7 +211,17 @@ class AbstractAction extends Controller_Abstract @@ -198,7 +211,17 @@ class AbstractAction extends Controller_Abstract
198 */ 211 */
199 protected function getUid() 212 protected function getUid()
200 { 213 {
201 - return 0; 214 + if (!$this->_uid) {
  215 + $cookie = $this->getCookie('_UID');
  216 + if (!empty($cookie)) {
  217 + $cookieList = explode('::', $cookie);
  218 + if (isset($cookieList[1]) && is_numeric($cookieList)) {
  219 + $this->_uid = $cookieList[1];
  220 + $this->_uname = $cookieList[0];
  221 + }
  222 + }
  223 + }
  224 + return $this->_uid;
202 } 225 }
203 226
204 /** 227 /**
@@ -216,12 +239,33 @@ class AbstractAction extends Controller_Abstract @@ -216,12 +239,33 @@ class AbstractAction extends Controller_Abstract
216 return $udid; 239 return $udid;
217 } 240 }
218 241
  242 + /**
  243 + * 获取当前登录的用户名字
  244 + *
  245 + * @return int
  246 + * @todo
  247 + */
  248 + protected function getUname()
  249 + {
  250 + if (!$this->_uname) {
  251 + $cookie = $this->getCookie('_UID');
  252 + if (!empty($cookie)) {
  253 + $cookieList = explode('::', $cookie);
  254 + if (isset($cookieList[0])) {
  255 + $this->_uname = $cookieList[0];
  256 + }
  257 + }
  258 + }
  259 + return $this->_uname;
  260 + }
  261 +
219 /* 262 /*
220 * 设置网站SEO的标题 263 * 设置网站SEO的标题
221 * 264 *
222 * @param string $title 标题 265 * @param string $title 标题
223 * @return void 266 * @return void
224 */ 267 */
  268 +
225 protected function setTitle($title) 269 protected function setTitle($title)
226 { 270 {
227 $this->_view->assign('title', $title . ' | '); 271 $this->_view->assign('title', $title . ' | ');
@@ -284,17 +328,18 @@ class AbstractAction extends Controller_Abstract @@ -284,17 +328,18 @@ class AbstractAction extends Controller_Abstract
284 $footer = array(); 328 $footer = array();
285 329
286 // 已登录 @todo 330 // 已登录 @todo
287 - if (false) { 331 + $name = $this->getUname();
  332 + if (!empty($name)) {
288 $footer['user'] = array(); 333 $footer['user'] = array();
289 - $footer['user']['name'] = 'goodboy'; // 昵称 334 + $footer['user']['name'] = $name; // 昵称
290 $footer['user']['url'] = ''; // 个人中心链接 335 $footer['user']['url'] = ''; // 个人中心链接
291 - $footer['user']['signoutUrl'] = ''; // 登出链接 336 + $footer['user']['signoutUrl'] = '/passport/login/out'; // 登出链接
292 } 337 }
293 // 未登录 338 // 未登录
294 else { 339 else {
295 $footer = array(); 340 $footer = array();
296 $footer['loginUrl'] = '/signin.html'; // 登录链接 341 $footer['loginUrl'] = '/signin.html'; // 登录链接
297 - $footer['signupUrl'] = '/login.html'; // 注册链接 342 + $footer['signupUrl'] = '/reg.html'; // 注册链接
298 } 343 }
299 344
300 $this->_view->assign('pageFooter', $footer); 345 $this->_view->assign('pageFooter', $footer);
@@ -313,25 +358,25 @@ class AbstractAction extends Controller_Abstract @@ -313,25 +358,25 @@ class AbstractAction extends Controller_Abstract
313 'textCn' => '男生', 358 'textCn' => '男生',
314 'textEn' => 'BOYS', 359 'textEn' => 'BOYS',
315 'styleClass' => 'boys', 360 'styleClass' => 'boys',
316 - 'url' => '/boys.html', 361 + 'url' => '/boys',
317 ), 362 ),
318 1 => array( 363 1 => array(
319 'textCn' => '女生', 364 'textCn' => '女生',
320 'textEn' => 'GIRLS', 365 'textEn' => 'GIRLS',
321 'styleClass' => 'girls', 366 'styleClass' => 'girls',
322 - 'url' => '/girls.html', 367 + 'url' => '/girls',
323 ), 368 ),
324 2 => array( 369 2 => array(
325 'textCn' => '潮童', 370 'textCn' => '潮童',
326 'textEn' => 'KIDS', 371 'textEn' => 'KIDS',
327 'styleClass' => 'kids', 372 'styleClass' => 'kids',
328 - 'url' => '/kids.html', 373 + 'url' => '/kids',
329 ), 374 ),
330 3 => array( 375 3 => array(
331 'textCn' => '创意生活', 376 'textCn' => '创意生活',
332 'textEn' => 'LIFE STYLE', 377 'textEn' => 'LIFE STYLE',
333 'styleClass' => 'life', 378 'styleClass' => 'life',
334 - 'url' => '/life.html', 379 + 'url' => '/lifestyle',
335 ), 380 ),
336 4 => array( 381 4 => array(
337 'textCn' => '逛', 382 'textCn' => '逛',
@@ -370,7 +415,6 @@ class AbstractAction extends Controller_Abstract @@ -370,7 +415,6 @@ class AbstractAction extends Controller_Abstract
370 ) 415 )
371 ), 416 ),
372 )); 417 ));
373 -  
374 } 418 }
375 419
376 /** 420 /**
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 * @version 1.0 (2015-9-30 16:42:51) 9 * @version 1.0 (2015-9-30 16:42:51)
10 * @author fei.hong <fei.hong@yoho.cn> 10 * @author fei.hong <fei.hong@yoho.cn>
11 */ 11 */
  12 +
12 namespace Api; 13 namespace Api;
13 14
14 use Plugin\Cache; 15 use Plugin\Cache;
@@ -16,8 +17,14 @@ use Plugin\Cache; @@ -16,8 +17,14 @@ use Plugin\Cache;
16 class Yohobuy 17 class Yohobuy
17 { 18 {
18 19
19 - const API_URL = 'http://api2.open.yohobuy.com/';  
20 - const SERVICE_URL = 'http://service.api.yohobuy.com/'; 20 +// /* 正式环境 */
  21 +// const API_URL = 'http://api2.open.yohobuy.com/';
  22 +// const SERVICE_URL = 'http://service.api.yohobuy.com/';
  23 +// const YOHOBUY_URL = 'http://www.yohobuy.com/';
  24 +
  25 + /* 测试环境 */
  26 + const API_URL = 'http://test2.open.yohobuy.com/';
  27 + const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
21 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 28 const YOHOBUY_URL = 'http://www.yohobuy.com/';
22 29
23 /** 30 /**
@@ -95,24 +102,13 @@ class Yohobuy @@ -95,24 +102,13 @@ class Yohobuy
95 * 102 *
96 * @param string $url 接口URL 103 * @param string $url 接口URL
97 * @param array $data 参数列表 104 * @param array $data 参数列表
  105 + * @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
98 * @param bool $returnJson 控制是否返回json格式数据 106 * @param bool $returnJson 控制是否返回json格式数据
99 * @param int $timeout 超时时间 107 * @param int $timeout 超时时间
100 * @return mixed 108 * @return mixed
101 */ 109 */
102 - 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)
103 { 111 {
104 -// // 代表是否开启缓存  
105 -// $useCache = $cache && isset($data['client_secret']);  
106 -//  
107 -// /* 先尝试获取一级缓存(master), 有数据则直接返回 */  
108 -// if ($useCache) {  
109 -// $key = md5($url . $data['client_secret']);  
110 -// $result = Cache::get($key, 'master');  
111 -// if (!empty($result)) {  
112 -// return $result;  
113 -// }  
114 -// }  
115 -  
116 // 销毁私钥参数 112 // 销毁私钥参数
117 if (isset($data['private_key'])) { 113 if (isset($data['private_key'])) {
118 unset($data['private_key']); 114 unset($data['private_key']);
@@ -121,6 +117,15 @@ class Yohobuy @@ -121,6 +117,15 @@ class Yohobuy
121 $url = self::httpBuildQuery($url, $data); 117 $url = self::httpBuildQuery($url, $data);
122 } 118 }
123 119
  120 + /* 开启缓存的情况 */
  121 + if ($cache) {
  122 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  123 + $result = Cache::get($url, 'master');
  124 + if (!empty($result)) {
  125 + return $result;
  126 + }
  127 + }
  128 +
124 $ch = curl_init($url); 129 $ch = curl_init($url);
125 curl_setopt($ch, CURLOPT_HEADER, 0); 130 curl_setopt($ch, CURLOPT_HEADER, 0);
126 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 131 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@@ -132,17 +137,17 @@ class Yohobuy @@ -132,17 +137,17 @@ class Yohobuy
132 curl_close($ch); 137 curl_close($ch);
133 $data = array(); 138 $data = array();
134 139
135 -// /* 设置一级二级缓存 或 获取二级缓存(slave) */  
136 -// if ($useCache) {  
137 -// // 如果接口异常没数据返回,则获取二级缓存  
138 -// if (empty($result)) {  
139 -// $result = Cache::get($key, 'slave');  
140 -// }  
141 -// // 如果接口正常有数据返回,则设置数据缓存  
142 -// else {  
143 -// Cache::set($key, $result);  
144 -// }  
145 -// } 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 + }
146 151
147 return $result; 152 return $result;
148 } 153 }
@@ -165,8 +170,7 @@ class Yohobuy @@ -165,8 +170,7 @@ class Yohobuy
165 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 170 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
166 if (!empty($header)) { 171 if (!empty($header)) {
167 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 172 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
168 - }  
169 - else { 173 + } else {
170 curl_setopt($ch, CURLOPT_HEADER, 0); 174 curl_setopt($ch, CURLOPT_HEADER, 0);
171 } 175 }
172 176
@@ -202,12 +206,22 @@ class Yohobuy @@ -202,12 +206,22 @@ class Yohobuy
202 * 206 *
203 * @param array $urlList 接口列表 207 * @param array $urlList 接口列表
204 * @param array $options CURL设置项 208 * @param array $options CURL设置项
205 - * @parma mixed $cache 控制是否启用接口数据的缓存 如3600表示缓存1小时, false表示不缓存 209 + * @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
206 * @param int $timeout 超时时间,单位是秒 210 * @param int $timeout 超时时间,单位是秒
207 * @return array 211 * @return array
208 */ 212 */
209 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)
210 { 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 +
211 $result = array(); 225 $result = array();
212 $response = array(); 226 $response = array();
213 $running = 0; 227 $running = 0;
@@ -242,8 +256,7 @@ class Yohobuy @@ -242,8 +256,7 @@ class Yohobuy
242 do { 256 do {
243 do { 257 do {
244 $status = curl_multi_exec($mh, $running); 258 $status = curl_multi_exec($mh, $running);
245 - }  
246 - while ($status == CURLM_CALL_MULTI_PERFORM); 259 + } while ($status == CURLM_CALL_MULTI_PERFORM);
247 260
248 if ($status != CURLM_OK) { 261 if ($status != CURLM_OK) {
249 break; 262 break;
@@ -252,8 +265,7 @@ class Yohobuy @@ -252,8 +265,7 @@ class Yohobuy
252 if ($running > 0) { 265 if ($running > 0) {
253 curl_multi_select($mh, 0.5); 266 curl_multi_select($mh, 0.5);
254 } 267 }
255 - }  
256 - while ($running); 268 + } while ($running);
257 269
258 // 获取API接口响应的结果 270 // 获取API接口响应的结果
259 foreach ($urlList as $name => $api) { 271 foreach ($urlList as $name => $api) {
@@ -278,6 +290,18 @@ class Yohobuy @@ -278,6 +290,18 @@ class Yohobuy
278 } 290 }
279 curl_multi_close($mh); 291 curl_multi_close($mh);
280 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 +
281 return $result; 305 return $result;
282 } 306 }
283 307
@@ -285,10 +309,25 @@ class Yohobuy @@ -285,10 +309,25 @@ class Yohobuy
285 * rpc调用远程服务(YAR) 309 * rpc调用远程服务(YAR)
286 * 310 *
287 * @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
288 * @return array 317 * @return array
289 */ 318 */
290 - public static function yarClient($uri, $method, $parameters = array(), $timeout = 3000) 319 + public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
291 { 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 +
292 $client = new \Yar_Client($uri); 331 $client = new \Yar_Client($uri);
293 $client->SetOpt(YAR_OPT_PACKAGER, 'php'); 332 $client->SetOpt(YAR_OPT_PACKAGER, 'php');
294 $client->SetOpt(YAR_OPT_TIMEOUT, $timeout); 333 $client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
@@ -300,6 +339,18 @@ class Yohobuy @@ -300,6 +339,18 @@ class Yohobuy
300 $result = array(); 339 $result = array();
301 } 340 }
302 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 +
303 return $result; 354 return $result;
304 } 355 }
305 356
@@ -322,6 +373,7 @@ class Yohobuy @@ -322,6 +373,7 @@ class Yohobuy
322 YAR_OPT_CONNECT_TIMEOUT => $timeout 373 YAR_OPT_CONNECT_TIMEOUT => $timeout
323 )); 374 ));
324 } 375 }
  376 +
325 public static function yarConcurrentLoop($callback = null) 377 public static function yarConcurrentLoop($callback = null)
326 { 378 {
327 \Yar_Concurrent_Client::loop($callback); 379 \Yar_Concurrent_Client::loop($callback);
  1 +<?php
  2 +
  3 +namespace Configs;
  4 +
  5 +/**
  6 + * 缓存配置文件
  7 + */
  8 +class CacheConfig
  9 +{
  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'; // 创意生活首页
  17 +
  18 +}
1 <?php 1 <?php
  2 +
2 namespace LibModels\Wap\Category; 3 namespace LibModels\Wap\Category;
3 4
4 use Api\Yohobuy; 5 use Api\Yohobuy;
@@ -15,6 +16,7 @@ use Api\Sign; @@ -15,6 +16,7 @@ use Api\Sign;
15 */ 16 */
16 class BrandData 17 class BrandData
17 { 18 {
  19 +
18 /** 20 /**
19 * 获取品牌数据 21 * 获取品牌数据
20 * 22 *
@@ -26,7 +28,6 @@ class BrandData @@ -26,7 +28,6 @@ class BrandData
26 { 28 {
27 // 构建必传参数 29 // 构建必传参数
28 $param = Yohobuy::param(); 30 $param = Yohobuy::param();
29 -  
30 $param['method'] = 'app.brand.brandlist'; 31 $param['method'] = 'app.brand.brandlist';
31 $param['yh_channel'] = $channel; 32 $param['yh_channel'] = $channel;
32 $param['client_secret'] = Sign::getSign($param); 33 $param['client_secret'] = Sign::getSign($param);
@@ -43,11 +44,10 @@ class BrandData @@ -43,11 +44,10 @@ class BrandData
43 { 44 {
44 // 构建必传参数 45 // 构建必传参数
45 $param = Yohobuy::param(); 46 $param = Yohobuy::param();
46 -  
47 $param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a'; 47 $param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a';
48 $param['client_secret'] = Sign::getSign($param); 48 $param['client_secret'] = Sign::getSign($param);
49 49
50 - return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param); 50 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
51 } 51 }
52 52
53 /** 53 /**
@@ -60,8 +60,7 @@ class BrandData @@ -60,8 +60,7 @@ class BrandData
60 { 60 {
61 // 构建必传参数 61 // 构建必传参数
62 $param = Yohobuy::param(); 62 $param = Yohobuy::param();
63 -  
64 - $param['brand_id'] = '$brandId'; 63 + $param['brand_id'] = $brandId;
65 $param['method'] = 'app.brand.getBrandIntro'; 64 $param['method'] = 'app.brand.getBrandIntro';
66 $param['client_secret'] = Sign::getSign($param); 65 $param['client_secret'] = Sign::getSign($param);
67 66
@@ -77,8 +76,7 @@ class BrandData @@ -77,8 +76,7 @@ class BrandData
77 { 76 {
78 // 构建必传参数 77 // 构建必传参数
79 $param = Yohobuy::param(); 78 $param = Yohobuy::param();
80 -  
81 - $param['brand_id'] = '$brandId'; 79 + $param['brand_id'] = $brandId;
82 $param['method'] = 'app.brand.banner'; 80 $param['method'] = 'app.brand.banner';
83 $param['client_secret'] = Sign::getSign($param); 81 $param['client_secret'] = Sign::getSign($param);
84 82
@@ -113,7 +111,9 @@ class BrandData @@ -113,7 +111,9 @@ class BrandData
113 'p_d' => $p_d 111 'p_d' => $p_d
114 ); 112 );
115 // 拉取筛选参数 113 // 拉取筛选参数
116 - $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); 114 + $queriedParams = array_filter($selectItems, function($v) {
  115 + return $v !== null;
  116 + });
117 117
118 // 构建必传参数 118 // 构建必传参数
119 $param = Yohobuy::param(); 119 $param = Yohobuy::param();
@@ -126,4 +126,5 @@ class BrandData @@ -126,4 +126,5 @@ class BrandData
126 126
127 return Yohobuy::get(Yohobuy::API_URL, $param); 127 return Yohobuy::get(Yohobuy::API_URL, $param);
128 } 128 }
  129 +
129 } 130 }
@@ -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,35 +49,16 @@ class IndexData @@ -53,35 +49,16 @@ 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;
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)
@@ -17,19 +17,43 @@ class NewsaleData @@ -17,19 +17,43 @@ class NewsaleData
17 { 17 {
18 18
19 /** 19 /**
20 - * 获取新品到着,折扣专区焦点图数据  
21 - * @param string $contentCode 内容位置码  
22 - * @return array 新品到着焦点图有关数据 20 + * 模糊搜索提供的关键词
  21 + * @param string $keyword 关键词
  22 + * @return array 根据跟定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
23 */ 23 */
24 - public static function getNewsaleFocus($contentCode) 24 + public static function searchFuzzyDatas($keyword)
25 { 25 {
26 // 构建必传参数 26 // 构建必传参数
27 $param = Yohobuy::param(); 27 $param = Yohobuy::param();
28 28
29 - $param['content_code'] = $contentCode; 29 + $param['keyword'] = $keyword;
  30 + $param['method'] = 'app.search.fuzzy';
30 $param['client_secret'] = Sign::getSign($param); 31 $param['client_secret'] = Sign::getSign($param);
31 32
32 - return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param); 33 + return Yohobuy::get(Yohobuy::API_URL, $param);
  34 + }
  35 +
  36 + /**
  37 + * 根据跟定查询数据搜索数据列表
  38 + * @param string $query 查询条件
  39 + * @param string $order 排列顺序,默认为倒序
  40 + * @param integer $page 指定查询是多少页,默认为第一页
  41 + * @param integer $limit 指定查询多少个,默认是60哥
  42 + * @return array 搜索到的数据
  43 + */
  44 + public static function searchLiDatas($query, $order = 's_t_desc', $page = 1, $limit = 60)
  45 + {
  46 + // 构建必传参数
  47 + $param = Yohobuy::param();
  48 +
  49 + $param['query'] = $query;
  50 + $param['method'] = 'app.search.li';
  51 + $param['order'] = $order;
  52 + $param['page'] = $page;
  53 + $param['limit'] = $limit;
  54 + $param['client_secret'] = Sign::getSign($param);
  55 +
  56 + return Yohobuy::get(Yohobuy::API_URL, $param);
33 } 57 }
34 58
35 } 59 }
@@ -33,10 +33,11 @@ class Cache @@ -33,10 +33,11 @@ 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 + try {
38 // WINDOWS 39 // WINDOWS
39 - if (PATH_SEPARATOR === '\\') { 40 + if (DIRECTORY_SEPARATOR === '\\') {
40 HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire); 41 HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
41 HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0); 42 HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);
42 } 43 }
@@ -45,6 +46,9 @@ class Cache @@ -45,6 +46,9 @@ class Cache
45 HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire); 46 HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
46 HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0); 47 HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0);
47 } 48 }
  49 + } catch (Exception $e) {
  50 + // do nothing
  51 + }
48 } 52 }
49 53
50 /** 54 /**
@@ -58,14 +62,18 @@ class Cache @@ -58,14 +62,18 @@ class Cache
58 { 62 {
59 $result = array(); 63 $result = array();
60 64
  65 + try {
61 // WINDOWS 66 // WINDOWS
62 - if (PATH_SEPARATOR === '\\') { 67 + if (DIRECTORY_SEPARATOR === '\\') {
63 $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node)); 68 $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
64 } 69 }
65 // LINUX 70 // LINUX
66 else { 71 else {
67 $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node)); 72 $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
68 } 73 }
  74 + } catch (Exception $e) {
  75 + $result = array();
  76 + }
69 77
70 return $result; 78 return $result;
71 } 79 }
@@ -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 }
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 /**
@@ -17,20 +18,21 @@ class FloorProcess @@ -17,20 +18,21 @@ class FloorProcess
17 public static function getContent($data, $type = 1) 18 public static function getContent($data, $type = 1)
18 { 19 {
19 $result = array(); 20 $result = array();
20 - if(empty($data['list'])){  
21 - return $result;  
22 - }  
23 - foreach ($data['list'] as $v){ 21 + if (!empty($data['list'])) {
  22 + $build = array();
  23 + foreach ($data['list'] as $v) {
24 $fun = $v['template_name']; 24 $fun = $v['template_name'];
25 -  
26 - $data = self::$fun($v['data'],$type);  
27 - if(empty($data)){ 25 + if (!is_callable("self::$fun")) {
28 continue; 26 continue;
29 } 27 }
30 - $result[] = $data; 28 + $build = self::$fun($v['data'], $type);
  29 + if (empty($build)) {
  30 + continue;
  31 + }
  32 + $result[] = $build;
  33 + }
31 } 34 }
32 return $result; 35 return $result;
33 -  
34 } 36 }
35 37
36 /** 38 /**
@@ -49,7 +51,7 @@ class FloorProcess @@ -49,7 +51,7 @@ class FloorProcess
49 } 51 }
50 $result['list'] = $data; 52 $result['list'] = $data;
51 53
52 - return array('bannerTop'=>$result); 54 + return array('bannerTop' => $result);
53 } 55 }
54 56
55 /** 57 /**
@@ -68,7 +70,7 @@ class FloorProcess @@ -68,7 +70,7 @@ class FloorProcess
68 } 70 }
69 $result['list'] = $data; 71 $result['list'] = $data;
70 72
71 - return array('iconsEnter'=>$result); 73 + return array('iconsEnter' => $result);
72 } 74 }
73 75
74 /** 76 /**
@@ -79,15 +81,16 @@ class FloorProcess @@ -79,15 +81,16 @@ class FloorProcess
79 */ 81 */
80 private static function single_image($data, $type) 82 private static function single_image($data, $type)
81 { 83 {
82 - if(empty($data)){ 84 + if (empty($data)) {
83 return array(); 85 return array();
84 } 86 }
  87 +
85 foreach ($data as &$one) { 88 foreach ($data as &$one) {
86 $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1); 89 $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
87 unset($one['src']); 90 unset($one['src']);
88 } 91 }
89 92
90 - return array('banner'=>$data); 93 + return array('banner' => $data);
91 } 94 }
92 95
93 /** 96 /**
@@ -109,7 +112,7 @@ class FloorProcess @@ -109,7 +112,7 @@ class FloorProcess
109 unset($data['title']); 112 unset($data['title']);
110 $result = $data; 113 $result = $data;
111 114
112 - return array('hotCategory'=>$result); 115 + return array('hotCategory' => $result);
113 } 116 }
114 117
115 /** 118 /**
@@ -131,7 +134,7 @@ class FloorProcess @@ -131,7 +134,7 @@ class FloorProcess
131 } 134 }
132 $result = $data; 135 $result = $data;
133 136
134 - return array('hotBrands'=>$result); 137 + return array('hotBrands' => $result);
135 } 138 }
136 139
137 /** 140 /**
@@ -154,7 +157,7 @@ class FloorProcess @@ -154,7 +157,7 @@ class FloorProcess
154 } 157 }
155 $result = $data; 158 $result = $data;
156 159
157 - return array('trendColloaction'=>$result); 160 + return array('trendColloaction' => $result);
158 } 161 }
159 162
160 /** 163 /**
@@ -173,7 +176,7 @@ class FloorProcess @@ -173,7 +176,7 @@ class FloorProcess
173 } 176 }
174 $result = $data; 177 $result = $data;
175 178
176 - return array('trendTopics'=>$result); 179 + return array('trendTopics' => $result);
177 } 180 }
178 181
179 /** 182 /**
@@ -199,7 +202,7 @@ class FloorProcess @@ -199,7 +202,7 @@ class FloorProcess
199 } 202 }
200 $result = $data; 203 $result = $data;
201 204
202 - return array('goodsCategory'=>$result); 205 + return array('goodsCategory' => $result);
203 } 206 }
204 207
205 /** 208 /**
@@ -226,7 +229,7 @@ class FloorProcess @@ -226,7 +229,7 @@ class FloorProcess
226 } 229 }
227 $result = $data; 230 $result = $data;
228 231
229 - return array('creativeLife'=>$result); 232 + return array('creativeLife' => $result);
230 } 233 }
231 234
232 /** 235 /**
@@ -245,7 +248,7 @@ class FloorProcess @@ -245,7 +248,7 @@ class FloorProcess
245 } 248 }
246 $result = $data; 249 $result = $data;
247 250
248 - return array('small_pic'=>$result); 251 + return array('small_pic' => $result);
249 } 252 }
250 253
251 /** 254 /**
@@ -254,14 +257,16 @@ class FloorProcess @@ -254,14 +257,16 @@ class FloorProcess
254 * @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle 257 * @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
255 * @return array 处理之后的单名字图片数据 258 * @return array 处理之后的单名字图片数据
256 */ 259 */
257 - private static function single_name_image($data,$type){  
258 -  
259 - if(empty($data)){ 260 + private static function single_name_image($data, $type)
  261 + {
  262 + if (empty($data)) {
260 return array(); 263 return array();
261 } 264 }
  265 +
262 $data['name'] = $data['title']; 266 $data['name'] = $data['title'];
263 - $data['img'] = Images::getImageUrl($data['src'], 640, 198, 2); 267 + $data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2);
264 268
265 - return array('plusStar'=>$data['data']); 269 + return array('plusStar' => $data);
266 } 270 }
  271 +
267 } 272 }
  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'));  
  1 +.brand-page {
  2 + font-size: 30rem / $pxConvertRem;
  3 +
  4 + .hot-brand {
  5 + margin: (30rem / $pxConvertRem) 0 0;
  6 +
  7 + .hot-brand-list {
  8 + background: #fff;
  9 + li {
  10 + float: left;
  11 + width: 158rem / $pxConvertRem;
  12 + height: 158rem / $pxConvertRem;
  13 +
  14 + .img-box {
  15 + width: 100%;
  16 + height: 100%;
  17 +
  18 + }
  19 + }
  20 + }
  21 + }
  22 +
  23 +
  24 +}
  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,5 @@ a { @@ -92,4 +92,5 @@ a {
92 @include border-radius(10px); 92 @include border-radius(10px);
93 } 93 }
94 94
  95 +
95 @import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index"; 96 @import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index";
  1 +{{> layout/header}}
  2 +<div class="brand-page yoho-page">
  3 + {{# bannerTop}}
  4 + {{> home/banner_top}}
  5 + {{/ bannerTop}}
  6 +
  7 + {{# hotBrand}}
  8 + <div class="hot-brand">
  9 + <ul class="hot-brand-list clearfix">
  10 + {{# list}}
  11 + <li>
  12 + <a href="{{url}}">
  13 + <div class="img-box">
  14 + <img class="lazy" data-original="{{img}}" alt="">
  15 + </div>
  16 + </a>
  17 + </li>
  18 + {{/ list}}
  19 + </ul>
  20 + </div>
  21 + {{/ hotBrand}}
  22 +
  23 + {{# brandList}}
  24 + <div class="brand-list">
  25 + <div class="title-bar">
  26 + <h2 style="position: static;">{{title}}</h2>
  27 + </div>
  28 + {{# list}}
  29 + <p>
  30 + <a href="{{url}}">{{name}}
  31 + <i class="icon-hot">
  32 + </i>
  33 + {{# isHot}}
  34 + <i class="icon-hot"></i>
  35 + {{/ isHot}}
  36 + {{# isNew}}
  37 + <i class="icon-new"></i>
  38 + {{/ isNew}}
  39 + </a>
  40 + </p>
  41 + {{/ list}}
  42 + </div>
  43 + {{/ brandList}}
  44 +
  45 + <div id="right-bar" class="right-bar" style="width: 30px; top: 88px;">
  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 + <b>&nbsp;</b>
  75 + <b>&nbsp;</b>
  76 + </div>
  77 + </div>
  78 +
  79 +</div>
  80 +{{> layout/footer}}
@@ -133,6 +133,12 @@ @@ -133,6 +133,12 @@
133 seajs.use('js/category/index'); 133 seajs.use('js/category/index');
134 </script> 134 </script>
135 {{/if}} 135 {{/if}}
  136 +{{!-- 品牌 --}}
  137 +{{#if brandPage}}
  138 + <script>
  139 + seajs.use('js/category/brand');
  140 + </script>
  141 +{{/if}}
136 142
137 {{!-- 搜索 --}} 143 {{!-- 搜索 --}}
138 {{#if searchPage}} 144 {{#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,29 +8,25 @@ use Plugin\DataProcess\FloorProcess; @@ -10,29 +8,25 @@ 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 // 设置网站标题
16 $this->setTitle('男生首页'); 17 $this->setTitle('男生首页');
17 // 显示侧边栏 18 // 显示侧边栏
18 $this->setNavSide(); 19 $this->setNavSide();
19 -  
20 - // 显示顶部下载  
21 - $this->setHeaderDownload();  
22 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
23 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
24 22
25 - $data = array('boysHomePage' => true);  
26 -  
27 - // 频道数据  
28 - $channelData = IndexData::getUserChannelData(0, '1,3', '201504091403001');  
29 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
30 - $data['content'] = FloorProcess::getContent($channelData['data']);  
31 - }  
32 -  
33 - $data['maybeLike'] = true; 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'boysHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getBoysFloor()
  28 + ));
34 29
35 - $this->_view->display('index', $data);  
36 } 30 }
37 31
38 } 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,27 +8,25 @@ use Plugin\DataProcess\FloorProcess; @@ -10,27 +8,25 @@ 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 // 设置网站标题
16 $this->setTitle('女生首页'); 17 $this->setTitle('女生首页');
17 // 显示侧边栏 18 // 显示侧边栏
18 $this->setNavSide(); 19 $this->setNavSide();
19 -  
20 - // 显示顶部下载  
21 - $this->setHeaderDownload();  
22 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
23 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
24 22
25 - $data = array('grilsHomePage' => true);  
26 -  
27 - // 频道数据  
28 - $channelData = IndexData::getUserChannelData(0, '2,3', '201504091403002');  
29 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
30 - $data['content'] = FloorProcess::getContent($channelData['data'], 2);  
31 - } 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'grilsHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getGirlsFloor()
  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\Helpers;  
6 4
7 /** 5 /**
8 * 频道选择 6 * 频道选择
@@ -11,26 +9,13 @@ class IndexController extends AbstractAction @@ -11,26 +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 - $data = array();  
19 -  
20 - // 背景图获取  
21 - $banner = IndexData::getBannerStart();  
22 - if ($banner) {  
23 - $data['background'] = Helpers::getImageUrl($banner, 640, 800, 1);  
24 - }  
25 -  
26 - // 设置底部导航信息  
27 - $this->setNavFooter();  
28 -  
29 - // 生成HTML (index.html)  
30 - $this->_view->html('index');  
31 -  
32 - // 渲染模板  
33 - $this->_view->display('index', $data); 16 + $this->_view->display('index', array(
  17 + 'background' => Index\HomeModel::getBgImage()
  18 + ));
34 } 19 }
35 20
36 } 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,29 +8,25 @@ use Plugin\DataProcess\FloorProcess; @@ -10,29 +8,25 @@ 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 // 设置网站标题
16 $this->setTitle('潮童首页'); 17 $this->setTitle('潮童首页');
17 // 显示侧边栏 18 // 显示侧边栏
18 $this->setNavSide(); 19 $this->setNavSide();
19 -  
20 - // 显示顶部下载  
21 - $this->setHeaderDownload();  
22 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
23 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
24 22
25 - $data = array('kidsHomePage' => true);  
26 -  
27 - // 频道数据  
28 - $channelData = IndexData::getUserChannelData(0, '', 'e9875682c1599a886bfbdb965b740022');  
29 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
30 - $data['content'] = FloorProcess::getContent($channelData['data'], 3);  
31 - }  
32 -  
33 - $data['maybeLike'] = true; 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'kidsHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getKidsFloor()
  28 + ));
34 29
35 - $this->_view->display('index', $data);  
36 } 30 }
37 31
38 } 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,29 +8,25 @@ use Plugin\DataProcess\FloorProcess; @@ -10,29 +8,25 @@ 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 // 设置网站标题
16 $this->setTitle('创意生活首页'); 17 $this->setTitle('创意生活首页');
17 // 显示侧边栏 18 // 显示侧边栏
18 $this->setNavSide(); 19 $this->setNavSide();
19 -  
20 - // 显示顶部下载  
21 - $this->setHeaderDownload();  
22 // 设置顶部信息(搜索) 20 // 设置顶部信息(搜索)
23 $this->setHomeChannelHeader(); 21 $this->setHomeChannelHeader();
24 22
25 - $data = array('lifestyleHomePage' => true);  
26 -  
27 - // 频道数据  
28 - $channelData = IndexData::getUserChannelData(0, '', '9aa25f5133f011ec96c2045eb15ae425');  
29 - if (isset($channelData['code']) && $channelData['code'] == 200) {  
30 - $data['content'] = FloorProcess::getContent($channelData['data'], 4);  
31 - }  
32 -  
33 - $data['maybeLike'] = true; 23 + // 渲染模板并输出
  24 + $this->_view->display('index', array(
  25 + 'lifestyleHomePage' => true,
  26 + 'maybeLike' => true,
  27 + 'content' => Index\HomeModel::getLifestyleFloor()
  28 + ));
34 29
35 - $this->_view->display('index', $data);  
36 } 30 }
37 31
38 } 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 +}
@@ -10,7 +10,7 @@ class BrandController extends AbstractAction @@ -10,7 +10,7 @@ class BrandController extends AbstractAction
10 public function indexAction() 10 public function indexAction()
11 { 11 {
12 // 获取品牌数据 12 // 获取品牌数据
13 - $brandTopData = BrandData::getBrandTopData(); 13 + /*$brandTopData = BrandData::getBrandTopData();
14 $brandsData = BrandData::getBrandsData(); 14 $brandsData = BrandData::getBrandsData();
15 15
16 $brandTop = array(); 16 $brandTop = array();
@@ -25,9 +25,117 @@ class BrandController extends AbstractAction @@ -25,9 +25,117 @@ class BrandController extends AbstractAction
25 } 25 }
26 26
27 echo '<pre>'; 27 echo '<pre>';
28 - var_dump($brandTop, $brands);exit; 28 + var_dump($brandTop, $brands);exit;*/
  29 +
  30 + $data = array (
  31 + 'brandPage' => true,
  32 + 'bannerTop' => array (
  33 + 'list' => array (
  34 + array (
  35 + 'url' => '',
  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'
  37 + ),
  38 + array (
  39 + 'url' => '',
  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'
  41 + ),
  42 + array (
  43 + 'url' => '',
  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'
  45 + )
  46 + )
  47 + ),
  48 + 'hotBrand' => array (
  49 + 'list' => array (
  50 + array (
  51 + 'url' => '',
  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 + ),
  54 + array (
  55 + 'url' => '',
  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'
  57 + ),
  58 + array (
  59 + 'url' => '',
  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'
  61 + ),
  62 + array (
  63 + 'url' => '',
  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'
  65 + ),
  66 + array (
  67 + 'url' => '',
  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'
  69 + ),
  70 + array (
  71 + 'url' => '',
  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'
  73 + ),
  74 + array (
  75 + 'url' => '',
  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'
  77 + ),
  78 + array (
  79 + 'url' => '',
  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'
  81 + )
  82 + )
  83 + ),
  84 + 'brandList' => array (
  85 + array (
  86 + 'title' => '0~9',
  87 + 'list' => array(
  88 + array (
  89 + 'name' => '004',
  90 + 'isHot' => true
  91 + ),
  92 + array (
  93 + 'name' => '10*1',
  94 + 'isNew' => true
  95 + ),
  96 + array (
  97 + 'name' => '2%'
  98 + )
  99 + )
  100 + ),
  101 + array (
  102 + 'title' => 'A',
  103 + 'list' => array(
  104 + array (
  105 + 'name' => 'Aape',
  106 + 'isHot' => true
  107 + ),
  108 + array (
  109 + 'name' => 'Adfdfd',
  110 + 'isNew' => true
  111 + ),
  112 + array (
  113 + 'name' => 'Acrwewwe'
  114 + )
  115 + )
  116 + ),
  117 + array (
  118 + 'title' => 'B',
  119 + 'list' => array(
  120 + array (
  121 + 'name' => 'Bape'
  122 + ),
  123 + array (
  124 + 'name' => 'Bdfdfd'
  125 + ),
  126 + array (
  127 + 'name' => 'Bcrwewwe'
  128 + )
  129 + )
  130 + )
  131 + )
  132 +
  133 +
  134 + );
  135 +
29 136
30 $this->_view->assign('title', 'YOHO!有货'); 137 $this->_view->assign('title', 'YOHO!有货');
31 - $this->_view->display('brand', compact('brands')); 138 + //$this->_view->display('brand', compact('brands'));
  139 + $this->_view->display('index', $data);
32 } 140 }
33 } 141 }
@@ -4,7 +4,7 @@ use LibModels\Wap\Category\ClassData; @@ -4,7 +4,7 @@ use LibModels\Wap\Category\ClassData;
4 use Plugin\DataProcess\ClassProcess; 4 use Plugin\DataProcess\ClassProcess;
5 5
6 /** 6 /**
7 - * 品 7 + * 品
8 */ 8 */
9 class ClassController extends AbstractAction 9 class ClassController extends AbstractAction
10 { 10 {
@@ -61,6 +61,18 @@ class LoginController extends AbstractAction @@ -61,6 +61,18 @@ class LoginController extends AbstractAction
61 } 61 }
62 62
63 /** 63 /**
  64 + * 退出
  65 + *
  66 + * @todo
  67 + */
  68 + public function outAction()
  69 + {
  70 + $this->setCookie('_UID', '');
  71 +
  72 + headers_sent() || header('Location: /');
  73 + }
  74 +
  75 + /**
64 * 登录操作 76 * 登录操作
65 * 77 *
66 * @param string areaCode 地区编号, 不需要+号 78 * @param string areaCode 地区编号, 不需要+号
@@ -95,9 +107,23 @@ class LoginController extends AbstractAction @@ -95,9 +107,23 @@ class LoginController extends AbstractAction
95 107
96 /* 调用登录接口进行登录 */ 108 /* 调用登录接口进行登录 */
97 $data = LoginData::signin($area, $profile, $password); 109 $data = LoginData::signin($area, $profile, $password);
98 - if ($data['code'] == 200) {  
99 - $data['data'] = '/'; // @todo 110 + if ($data['code'] != 200 || !isset($data['data']['uid'])) {
  111 + break;
100 } 112 }
  113 +
  114 +// /* 获取用户的信息 */
  115 +// $profile = LoginData::profile($data['data']['uid']);
  116 +// $name = 'YOHO!';
  117 +// if (!empty($profile['data']['nickname'])) {
  118 +// $name = $profile['data']['nickname'];
  119 +// } elseif (!empty($profile['data']['username'])) {
  120 +// $name = $profile['data']['username'];
  121 +// } elseif (!empty($profile['data']['email'])) {
  122 +// $name = $profile['data']['email'];
  123 +// } elseif (!empty($profile['data']['mobile'])) {
  124 +// $name = $profile['data']['mobile'];
  125 +// }
  126 + $data['data'] = '/'; // @todo
101 } 127 }
102 while (false); 128 while (false);
103 129
@@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index" @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
19 application.dispatcher.defaultAction = "index" 19 application.dispatcher.defaultAction = "index"
20 20
21 ;;初始化命名空间 21 ;;初始化命名空间
22 -application.namespaces = "Action,Api,LibModels,Plugin" 22 +application.namespaces = "Action,Api,Configs,LibModels,Plugin"
23 23
24 ;;使用composer 24 ;;使用composer
25 composer.autoload = 0 25 composer.autoload = 0
@@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index" @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
19 application.dispatcher.defaultAction = "index" 19 application.dispatcher.defaultAction = "index"
20 20
21 ;;初始化命名空间 21 ;;初始化命名空间
22 -application.namespaces = "Action,Api,LibModels,Plugin" 22 +application.namespaces = "Action,Api,Configs,LibModels,Plugin"
23 23
24 ;;使用composer 24 ;;使用composer
25 composer.autoload = 0 25 composer.autoload = 0
@@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index" @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
19 application.dispatcher.defaultAction = "index" 19 application.dispatcher.defaultAction = "index"
20 20
21 ;;初始化命名空间 21 ;;初始化命名空间
22 -application.namespaces = "Action,Api,LibModels,Plugin" 22 +application.namespaces = "Action,Api,Configs,LibModels,Plugin"
23 23
24 ;;使用composer 24 ;;使用composer
25 composer.autoload = 0 25 composer.autoload = 0
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');
  1 +User-agent: *
  2 +Disallow: /