Authored by xuqi

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

  1 +<?php
  2 +
  3 +namespace Configs;
  4 +
  5 +/**
  6 + * 缓存配置文件
  7 + */
  8 +class WebCacheConfig
  9 +{
  10 +
  11 + const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据
  12 + const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]
  13 + const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]
  14 + const KEY_WEB_PRODUCT_SEARCH_DATA = 'key_web_product_search_data'; // web搜索的数据
  15 +
  16 +}
@@ -19,8 +19,11 @@ class IndexData @@ -19,8 +19,11 @@ class IndexData
19 */ 19 */
20 public static function getNavData($status = 1, $fields = 'id,sort_name,sort_name_en,parent_id,sort_url,sort_ico,content_code,is_new,is_hot,separative_sign') 20 public static function getNavData($status = 1, $fields = 'id,sort_name,sort_name_en,parent_id,sort_url,sort_ico,content_code,is_new,is_hot,separative_sign')
21 { 21 {
22 - $params = array('parent_id'=>'','platform'=>'web',  
23 - 'status'=> $status,'fields'=> $fields 22 + $params = array(
  23 + 'parent_id'=>'',
  24 + 'platform'=>'web',
  25 + 'status'=> $status,
  26 + 'fields'=> $fields
24 ); 27 );
25 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_CATEGORY,'getCategory', $params); 28 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_CATEGORY,'getCategory', $params);
26 } 29 }
1 <script> 1 <script>
2 seajs.use('js/common'); 2 seajs.use('js/common');
3 </script> 3 </script>
  4 +{{!-- 正常头部 --}}
  5 +{{#headerdata}}
  6 + <script>
  7 + seajs.use('js/header',function(header){
  8 + header.init();
  9 + });
  10 + </script>
  11 +{{/headerdata}}
  12 +{{!-- 简单头部 --}}
  13 +{{#simpleHeader}}
  14 + <script>
  15 + seajs.use('js/simple-header',function(simpleheader){
  16 + simpleheader.init();
  17 + });
  18 + </script>
  19 +{{/simpleHeader}}
4 {{!-- 首页 --}} 20 {{!-- 首页 --}}
5 {{#if boysHomePage}} 21 {{#if boysHomePage}}
6 <script> 22 <script>
1 var webYohobuy; 1 var webYohobuy;
2 2
3 require('./js/common'); 3 require('./js/common');
4 - 4 +require('./js/header');
  5 +require('./js/simple-header');
5 require('./js/product/entry'); 6 require('./js/product/entry');
6 require('./js/home/entry'); 7 require('./js/home/entry');
7 require('./js/passport/entry'); 8 require('./js/passport/entry');
@@ -5,11 +5,13 @@ @@ -5,11 +5,13 @@
5 */ 5 */
6 var $ = require('yoho.jquery'); 6 var $ = require('yoho.jquery');
7 7
  8 +
8 var $body = $('body'); 9 var $body = $('body');
9 10
10 require('./footer'); 11 require('./footer');
11 12
12 13
  14 +
13 function cookie(name) { 15 function cookie(name) {
14 var cookies = document.cookie, 16 var cookies = document.cookie,
15 cookieVal, 17 cookieVal,
@@ -116,7 +118,7 @@ function getShoppingKey() { @@ -116,7 +118,7 @@ function getShoppingKey() {
116 118
117 uid = uid === 0 ? '' : uid; 119 uid = uid === 0 ? '' : uid;
118 120
119 - window._ozuid = uid;//暴露ozuid 121 + window._ozuid = uid; //暴露ozuid
120 122
121 if (window._yas) { 123 if (window._yas) {
122 window._yas(1 * new Date(), '1.0.14', 'yohobuy_web', uid, '', ''); 124 window._yas(1 * new Date(), '1.0.14', 'yohobuy_web', uid, '', '');
@@ -151,3 +153,4 @@ window.getUser = getUser; @@ -151,3 +153,4 @@ window.getUser = getUser;
151 window.getUid = getUid; 153 window.getUid = getUid;
152 154
153 window.getShoppingKey = getShoppingKey; 155 window.getShoppingKey = getShoppingKey;
  156 +
@@ -1509,7 +1509,7 @@ function actionLoginInfo() { @@ -1509,7 +1509,7 @@ function actionLoginInfo() {
1509 * 初始化函数 1509 * 初始化函数
1510 * @return {[type]} [description] 1510 * @return {[type]} [description]
1511 */ 1511 */
1512 -function init() { 1512 +exports.init = function() {
1513 actionNav(); //处理导航 1513 actionNav(); //处理导航
1514 actionTipPic(); //鼠标移入后查询 1514 actionTipPic(); //鼠标移入后查询
1515 actionExeTemplate(); //处理模板 1515 actionExeTemplate(); //处理模板
@@ -1533,6 +1533,5 @@ function init() { @@ -1533,6 +1533,5 @@ function init() {
1533 actionLoginInfo(); //获取登录信息 1533 actionLoginInfo(); //获取登录信息
1534 actionCover(); //初次登录弹框 1534 actionCover(); //初次登录弹框
1535 actionAddKeyWords(); //增加关键字 1535 actionAddKeyWords(); //增加关键字
1536 -} 1536 +};
1537 1537
1538 -init();  
@@ -198,8 +198,8 @@ function msgCaptchaAjaxFn(page, callback) { @@ -198,8 +198,8 @@ function msgCaptchaAjaxFn(page, callback) {
198 function validateRule(page, $element, callback) { 198 function validateRule(page, $element, callback) {
199 199
200 var val = $.trim($element.val()), 200 var val = $.trim($element.val()),
201 - regionCode;  
202 - 201 + regionCode,
  202 + pwdReg = /^([a-zA-Z0-9\-\+_!@\#$%\^&\*\(\)\:\;\.=\[\]\\\',\?]){6,20}$/gi;
203 203
204 //手机号校验 204 //手机号校验
205 if ($element.hasClass('phone-num')) { 205 if ($element.hasClass('phone-num')) {
@@ -266,6 +266,7 @@ function validateRule(page, $element, callback) { @@ -266,6 +266,7 @@ function validateRule(page, $element, callback) {
266 } else { 266 } else {
267 validateResult[2].message = '短信验证码错误'; 267 validateResult[2].message = '短信验证码错误';
268 validateResult[2].status = false; 268 validateResult[2].status = false;
  269 + callback();
269 } 270 }
270 } 271 }
271 272
@@ -279,8 +280,8 @@ function validateRule(page, $element, callback) { @@ -279,8 +280,8 @@ function validateRule(page, $element, callback) {
279 validateResult[3].message = '密码只支持6-20位字符'; 280 validateResult[3].message = '密码只支持6-20位字符';
280 validateResult[3].status = false; 281 validateResult[3].status = false;
281 282
282 - } else if (/\s/.test($element.val())) {  
283 - validateResult[3].message = '密码不能包含空格'; 283 + } else if (!pwdReg.test($element.val())) {
  284 + validateResult[3].message = '密码只能包含字母,数字,半角标点符号';
284 validateResult[3].status = false; 285 validateResult[3].status = false;
285 286
286 } else { 287 } else {
@@ -420,10 +421,8 @@ exports.init = function(page) { @@ -420,10 +421,8 @@ exports.init = function(page) {
420 421
421 $('#agree-terms').click(function() { 422 $('#agree-terms').click(function() {
422 if ($(this).attr('notchecked')) { 423 if ($(this).attr('notchecked')) {
423 - console.log(1);  
424 $(this).removeAttr('notchecked'); 424 $(this).removeAttr('notchecked');
425 } else { 425 } else {
426 - console.log(2);  
427 $(this).attr('notchecked', 'true'); 426 $(this).attr('notchecked', 'true');
428 } 427 }
429 428
@@ -186,11 +186,20 @@ $goodInfoMain.on('click', '.col-btn', function() { @@ -186,11 +186,20 @@ $goodInfoMain.on('click', '.col-btn', function() {
186 }); 186 });
187 187
188 // 左侧导航 188 // 左侧导航
189 -$productListNav.click(function() { 189 +$productListNav.click(function(event) {
  190 +
  191 + if (!$(event.target).hasClass('product-list-nav')) {
  192 + return;
  193 + }
  194 +
190 if ($(this).hasClass('active')) { 195 if ($(this).hasClass('active')) {
  196 +
191 $(this).find('.sort-child-list').stop(true, true).slideUp(); 197 $(this).find('.sort-child-list').stop(true, true).slideUp();
  198 +
192 } else { 199 } else {
  200 +
193 $(this).find('.sort-child-list').stop(true, true).slideDown(); 201 $(this).find('.sort-child-list').stop(true, true).slideDown();
194 } 202 }
  203 +
195 $(this).toggleClass('active'); 204 $(this).toggleClass('active');
196 }); 205 });
@@ -94,8 +94,7 @@ function actionLoginInfo() { @@ -94,8 +94,7 @@ function actionLoginInfo() {
94 * 初始化函数 94 * 初始化函数
95 * @return {[type]} [description] 95 * @return {[type]} [description]
96 */ 96 */
97 -function init() { 97 +exports.init = function() {
98 actionLoginInfo(); //获取登录信息 98 actionLoginInfo(); //获取登录信息
99 -} 99 +};
100 100
101 -init();  
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 .good-detail-text { 39 .good-detail-text {
40 color: #222; 40 color: #222;
41 font-size: 12px; 41 font-size: 12px;
42 - text-align: center; 42 + text-align: left;
43 overflow: hidden; 43 overflow: hidden;
44 44
45 > a { 45 > a {
@@ -9,12 +9,12 @@ @@ -9,12 +9,12 @@
9 } 9 }
10 10
11 .goods { 11 .goods {
12 - width: 984px; 12 + min-width: 984px;
13 height: 241px; 13 height: 241px;
14 margin: 30px 0; 14 margin: 30px 0;
15 overflow: hidden; 15 overflow: hidden;
16 } 16 }
17 - 17 +
18 .good { 18 .good {
19 float: left; 19 float: left;
20 margin-right: 14px; 20 margin-right: 14px;
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 .min-screen .latest-walk { 52 .min-screen .latest-walk {
53 .goods { 53 .goods {
54 width: 820px; 54 width: 820px;
  55 + min-width: 820px;
55 height: 301px; 56 height: 301px;
56 } 57 }
57 58
@@ -63,4 +64,4 @@ @@ -63,4 +64,4 @@
63 width: 195px; 64 width: 195px;
64 height: 261px; 65 height: 261px;
65 } 66 }
66 -}  
  67 +}
1 <?php 1 <?php
2 -use Action\WebAction; 2 +
  3 +use Action\WebAction;
3 use Index\HomeModel; 4 use Index\HomeModel;
  5 +
4 /** 6 /**
5 - * 女 7 + * 女生首页
6 */ 8 */
7 class GirlsController extends WebAction 9 class GirlsController extends WebAction
8 { 10 {
9 11
10 public function indexAction() 12 public function indexAction()
11 { 13 {
  14 + // 设置客户端浏览器1分钟内不改变
  15 + $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
  16 + // 设置浏览器缓存1分钟
  17 + $this->setExpires(60);
  18 +
  19 + // 设置网站SEO信息
12 $this->setTitle('女生|时尚潮流女装,日韩女装,潮牌女装全球购|YOHO!BUY有货 100%正品保证', false); 20 $this->setTitle('女生|时尚潮流女装,日韩女装,潮牌女装全球购|YOHO!BUY有货 100%正品保证', false);
13 $this->setKeywords('女生服饰,时尚潮流女装,日韩女装,女装正品购物网站,女装全球购'); 21 $this->setKeywords('女生服饰,时尚潮流女装,日韩女装,女装正品购物网站,女装全球购');
14 $this->setDescription('YOHO!BUY有货官网女生频道汇集了全球女装潮流时尚,提供时尚潮流女装,日版女装,韩版女装,潮牌女装正品全球购。YOHO!BUY有货购物100%正品保证,支持货到付款。'); 22 $this->setDescription('YOHO!BUY有货官网女生频道汇集了全球女装潮流时尚,提供时尚潮流女装,日版女装,韩版女装,潮牌女装正品全球购。YOHO!BUY有货购物100%正品保证,支持货到付款。');
  23 +
  24 + // 传递模板数据,渲染模板
15 $this->setWebNavHeader(HomeModel::COOKIE_NAME_GIRLS); 25 $this->setWebNavHeader(HomeModel::COOKIE_NAME_GIRLS);
16 $data = array( 26 $data = array(
17 'boysHomePage' => true, 27 'boysHomePage' => true,
18 - 'footerTop'=> true, 28 + 'footerTop' => true,
19 'girls' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_GIRLS, HomeModel::CODE_GIRLS_CHANNEL) 29 'girls' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_GIRLS, HomeModel::CODE_GIRLS_CHANNEL)
20 ); 30 );
21 $this->_view->display('index', $data); 31 $this->_view->display('index', $data);
22 } 32 }
23 -  
24 -}  
  33 +
  34 +}
1 <?php 1 <?php
2 2
3 use Action\WebAction; 3 use Action\WebAction;
  4 +use Index\HomeModel;
4 5
5 /** 6 /**
6 * 默认控制器 7 * 默认控制器
@@ -15,7 +16,7 @@ class IndexController extends WebAction @@ -15,7 +16,7 @@ class IndexController extends WebAction
15 { 16 {
16 if (null !== $this->get('go')) { 17 if (null !== $this->get('go')) {
17 // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页 18 // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
18 - \Index\HomeModel::goSwitchChannel(); 19 + HomeModel::goSwitchChannel();
19 } else { 20 } else {
20 // 设置客户端浏览器1分钟内不改变 21 // 设置客户端浏览器1分钟内不改变
21 $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y'))); 22 $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
@@ -23,11 +24,12 @@ class IndexController extends WebAction @@ -23,11 +24,12 @@ class IndexController extends WebAction
23 $this->setExpires(60); 24 $this->setExpires(60);
24 } 25 }
25 26
26 - $this->setWebNavHeader(\Index\HomeModel::COOKIE_NAME_BOYS); 27 + // 传递模板数据,渲染模板
  28 + $this->setWebNavHeader(HomeModel::COOKIE_NAME_BOYS);
27 $data = array( 29 $data = array(
28 'boysHomePage' => true, 30 'boysHomePage' => true,
29 'footerTop'=> true, 31 'footerTop'=> true,
30 - 'boys' => \Index\HomeModel::getChannelResource(\Index\HomeModel::COOKIE_NAME_BOYS, \Index\HomeModel::CODE_BOYS_CHANNEL) 32 + 'boys' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_BOYS, HomeModel::CODE_BOYS_CHANNEL)
31 ); 33 );
32 $this->_view->display('index', $data); 34 $this->_view->display('index', $data);
33 } 35 }
1 <?php 1 <?php
  2 +
2 use Action\WebAction; 3 use Action\WebAction;
3 use Index\HomeModel; 4 use Index\HomeModel;
4 5
@@ -10,15 +11,23 @@ class KidsController extends WebAction @@ -10,15 +11,23 @@ class KidsController extends WebAction
10 11
11 public function indexAction() 12 public function indexAction()
12 { 13 {
  14 + // 设置客户端浏览器1分钟内不改变
  15 + $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
  16 + // 设置浏览器缓存1分钟
  17 + $this->setExpires(60);
  18 +
  19 + // 设置网站SEO信息
13 $this->setTitle('潮童|男童装,女童装,韩版童装,儿童服装服饰|YOHO!BUY有货 100%正品保证', false); 20 $this->setTitle('潮童|男童装,女童装,韩版童装,儿童服装服饰|YOHO!BUY有货 100%正品保证', false);
14 $this->setKeywords('潮童,男童装,女童装,韩版童装,儿童服装服饰'); 21 $this->setKeywords('潮童,男童装,女童装,韩版童装,儿童服装服饰');
15 $this->setDescription('YOHO!BUY有货官网潮童频道汇集了全球潮童潮流时尚,提供新款男童装,女童装,韩版童装,儿童服装服饰正品全球购。YOHO!BUY有货购物100%正品保证,支持货到付款。'); 22 $this->setDescription('YOHO!BUY有货官网潮童频道汇集了全球潮童潮流时尚,提供新款男童装,女童装,韩版童装,儿童服装服饰正品全球购。YOHO!BUY有货购物100%正品保证,支持货到付款。');
  23 +
16 $this->setWebNavHeader(HomeModel::COOKIE_NAME_KIDS); 24 $this->setWebNavHeader(HomeModel::COOKIE_NAME_KIDS);
17 $data = array( 25 $data = array(
18 'boysHomePage' => true, 26 'boysHomePage' => true,
19 - 'footerTop'=> true, 27 + 'footerTop' => true,
20 'kids' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_KIDS, HomeModel::CODE_KIDS_CHANNEL) 28 'kids' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_KIDS, HomeModel::CODE_KIDS_CHANNEL)
21 ); 29 );
22 $this->_view->display('index', $data); 30 $this->_view->display('index', $data);
23 } 31 }
24 -}  
  32 +
  33 +}
1 <?php 1 <?php
  2 +
2 use Action\WebAction; 3 use Action\WebAction;
3 use Index\HomeModel; 4 use Index\HomeModel;
4 5
@@ -10,15 +11,24 @@ class LifestyleController extends WebAction @@ -10,15 +11,24 @@ class LifestyleController extends WebAction
10 11
11 public function indexAction() 12 public function indexAction()
12 { 13 {
  14 + // 设置客户端浏览器1分钟内不改变
  15 + $this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
  16 + // 设置浏览器缓存1分钟
  17 + $this->setExpires(60);
  18 +
  19 + // 设置网站的SEO信息
13 $this->setTitle('创意生活|创意生活馆,潮流创意家居,家居生活用品|YOHO!BUY有货 100%正品保证', false); 20 $this->setTitle('创意生活|创意生活馆,潮流创意家居,家居生活用品|YOHO!BUY有货 100%正品保证', false);
14 $this->setKeywords('创意生活,创意生活馆,潮流家居,潮流创意家居,家居生活用品,YOHO!有货'); 21 $this->setKeywords('创意生活,创意生活馆,潮流家居,潮流创意家居,家居生活用品,YOHO!有货');
15 $this->setDescription('YOHO!BUY有货官网创意生活频道汇集了创意生活馆,潮流创意家居,家居生活用品等正品网购,给您的生活带来更多创意。YOHO!BUY有货购物100%正品保证,支持货到付款。'); 22 $this->setDescription('YOHO!BUY有货官网创意生活频道汇集了创意生活馆,潮流创意家居,家居生活用品等正品网购,给您的生活带来更多创意。YOHO!BUY有货购物100%正品保证,支持货到付款。');
  23 +
  24 + // 传递模板数据,渲染模板
16 $this->setWebNavHeader(HomeModel::COOKIE_NAME_LIFESTYLE); 25 $this->setWebNavHeader(HomeModel::COOKIE_NAME_LIFESTYLE);
17 $data = array( 26 $data = array(
18 'boysHomePage' => true, 27 'boysHomePage' => true,
19 - 'footerTop'=> true, 28 + 'footerTop' => true,
20 'lifestyle' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_LIFESTYLE, HomeModel::CODE_LIFESTYLE_CHANNEL) 29 'lifestyle' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_LIFESTYLE, HomeModel::CODE_LIFESTYLE_CHANNEL)
21 ); 30 );
22 $this->_view->display('index', $data); 31 $this->_view->display('index', $data);
23 } 32 }
  33 +
24 } 34 }
1 <?php 1 <?php
2 namespace Index; 2 namespace Index;
3 3
4 -use Configs\CacheConfig; 4 +use Configs\WebCacheConfig;
5 use Configs\ChannelConfig; 5 use Configs\ChannelConfig;
6 use WebPlugin\Helpers; 6 use WebPlugin\Helpers;
7 use WebPlugin\Cache; 7 use WebPlugin\Cache;
@@ -58,17 +58,18 @@ class HomeModel @@ -58,17 +58,18 @@ class HomeModel
58 */ 58 */
59 public static function getNavBars($channel = 'boys') 59 public static function getNavBars($channel = 'boys')
60 { 60 {
61 - $menu = array();  
62 - $key = CacheConfig::KEY_WEB_HOME_NAVBAR_DATA.'_'.$channel; 61 + $key = WebCacheConfig::KEY_WEB_HOME_NAVBAR_DATA . '_' . $channel;
63 $menu = Cache::get($key); 62 $menu = Cache::get($key);
64 - $data = array();  
65 - if(empty($menu)) {//数据缓存不存在 63 + //数据缓存不存在
  64 + if(empty($menu)) {
66 $data = IndexData::getNavData(); 65 $data = IndexData::getNavData();
67 -  
68 //接口存在数据 66 //接口存在数据
69 if(!empty($data['data'])) { 67 if(!empty($data['data'])) {
70 $item = array(); 68 $item = array();
71 - $index_main = 0; 69 + $subnav = array();
  70 + $thirdnav = array();
  71 + $indexMain = 0;
  72 + $indexSub = 0;
72 foreach ($data['data'] as $val) { 73 foreach ($data['data'] as $val) {
73 $item = array( 74 $item = array(
74 'name_cn' => $val['sort_name'], // 父级 75 'name_cn' => $val['sort_name'], // 父级
@@ -76,13 +77,13 @@ class HomeModel @@ -76,13 +77,13 @@ class HomeModel
76 'link' => $val['sort_url'], 77 'link' => $val['sort_url'],
77 'icon' => $val['sort_ico'], 78 'icon' => $val['sort_ico'],
78 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '', 79 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
79 - 'index_main' => $index_main ++, 80 + 'index_main' => $indexMain ++,
80 'content_code' => $val['content_code'], 81 'content_code' => $val['content_code'],
81 'is_hot' => $val['is_hot'] == 'Y' ? true : false, 82 'is_hot' => $val['is_hot'] == 'Y' ? true : false,
82 'is_new' => $val['is_new'] == 'Y' ? true : false, 83 'is_new' => $val['is_new'] == 'Y' ? true : false,
83 // 'subnav' => array() 84 // 'subnav' => array()
84 ); 85 );
85 - $index_sub = 0; 86 + $indexSub = 0;
86 foreach ($val['sub'] as $sub) { // 二级 87 foreach ($val['sub'] as $sub) { // 二级
87 $subnav = array( 88 $subnav = array(
88 'name' => $sub['sort_name'], 89 'name' => $sub['sort_name'],
@@ -92,9 +93,10 @@ class HomeModel @@ -92,9 +93,10 @@ class HomeModel
92 'is_new' => $sub['is_new'] == 'Y' ? true : false, 93 'is_new' => $sub['is_new'] == 'Y' ? true : false,
93 'content_code' => $sub['content_code'], 94 'content_code' => $sub['content_code'],
94 // 'thirdnav' => array(), 95 // 'thirdnav' => array(),
95 - 'index_sub' => $index_sub ++ 96 + 'index_sub' => $indexSub ++
96 ); 97 );
97 if (isset($sub['sub'])) { 98 if (isset($sub['sub'])) {
  99 + $thirdnav = array();
98 foreach ($sub['sub'] as $thirdsub) { // 三级 100 foreach ($sub['sub'] as $thirdsub) { // 三级
99 $thirdnav = array( 101 $thirdnav = array(
100 'title' => $thirdsub['sort_name'], 102 'title' => $thirdsub['sort_name'],
@@ -123,8 +125,9 @@ class HomeModel @@ -123,8 +125,9 @@ class HomeModel
123 Cache::set($key, $menu, 3600); 125 Cache::set($key, $menu, 3600);
124 } 126 }
125 } 127 }
  128 +
126 //数据缓存和接口都空的,取二级数据 129 //数据缓存和接口都空的,取二级数据
127 - if(empty($menu) && empty($data)) { 130 + if(empty($menu)) {
128 $menu = Cache::get($key,'slave'); 131 $menu = Cache::get($key,'slave');
129 } 132 }
130 133
@@ -176,25 +179,27 @@ class HomeModel @@ -176,25 +179,27 @@ class HomeModel
176 /** 179 /**
177 * 获取频道资源 180 * 获取频道资源
178 * 181 *
179 - * @param string $channel  
180 - * @param string $content_code 182 + * @param string $channel 频道标识(boys,girls,kids,lifestyle)
  183 + * @param string $contentCode 资源码
181 * @return array 184 * @return array
182 */ 185 */
183 - public static function getChannelResource($channel, $content_code) 186 + public static function getChannelResource($channel, $contentCode)
184 { 187 {
185 - $key = CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$content_code; 188 + $key = WebCacheConfig::KEY_WEB_HOME_CHANNEL_DATA . '_' . $contentCode;
186 $data = Cache::get($key); 189 $data = Cache::get($key);
187 - $resource = array();  
188 if(empty($data)) { 190 if(empty($data)) {
189 - $resource = IndexData::getResourceData($content_code);  
190 - if(isset($resource['data']) && !empty($resource['data']) && $resource['code'] == 200) { 191 + $resource = IndexData::getResourceData($contentCode);
  192 + if (isset($resource['data']) && !empty($resource['data']) && $resource['code'] == 200) {
191 //格式化数据 193 //格式化数据
192 $data = ChannelProcess::getFormat($channel, $resource['data']); 194 $data = ChannelProcess::getFormat($channel, $resource['data']);
193 - Cache::set($key, $data, 3600);//设置master,slave 195 + //设置master,slave
  196 + Cache::set($key, $data, 3600);
  197 + //清空变量
  198 + $resource = array();
194 } 199 }
195 } 200 }
196 //master没有数据,资源位没有数据, 取二层缓存 201 //master没有数据,资源位没有数据, 取二层缓存
197 - if(empty($data) && (empty($resource) || !isset($resource['data']))) { 202 + if(empty($data)) {
198 $data = Cache::get($key, 'slave'); 203 $data = Cache::get($key, 'slave');
199 } 204 }
200 return $data; 205 return $data;