Authored by 毕凯

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

@@ -465,7 +465,7 @@ class WebAction extends Controller_Abstract @@ -465,7 +465,7 @@ class WebAction extends Controller_Abstract
465 */ 465 */
466 protected function setWebNavHeader($channel = '') 466 protected function setWebNavHeader($channel = '')
467 { 467 {
468 - //TODO 468 + //TODO
469 if(empty($channel)) { 469 if(empty($channel)) {
470 $channel = \Index\HomeModel::getSwitchChannel(); 470 $channel = \Index\HomeModel::getSwitchChannel();
471 } 471 }
@@ -477,63 +477,63 @@ class WebAction extends Controller_Abstract @@ -477,63 +477,63 @@ class WebAction extends Controller_Abstract
477 'gobytype'=> 'gobuy'.$channel, 477 'gobytype'=> 'gobuy'.$channel,
478 'searchcate'=>'searchcate'.$channel, 478 'searchcate'=>'searchcate'.$channel,
479 'myyoho' => array( 479 'myyoho' => array(
480 - 'email'=>'hhh@126.com',  
481 - 'viptype'=>'普通会员',  
482 - 'currentscore' => 495,  
483 - 'totalscore' => 600,  
484 - 'cardtype' => '银卡',  
485 - 'infolist' => array(  
486 - array(  
487 - 'name' =>'待处理的订单',  
488 - 'link' =>'',  
489 - 'num' => '0'  
490 - ),  
491 - array(  
492 - 'name' =>'我的收藏',  
493 - 'link' =>'',  
494 - 'num' => '1'  
495 - ), 480 + 'email'=>'hhh@126.com',
  481 + 'viptype'=>'普通会员',
  482 + 'currentscore' => 495,
  483 + 'totalscore' => 600,
  484 + 'cardtype' => '银卡',
  485 + 'infolist' => array(
496 array( 486 array(
497 - 'name' =>'我的优惠券',  
498 - 'link' =>'',  
499 - 'num' => '2'  
500 - ), 487 + 'name' =>'待处理的订单',
  488 + 'link' =>'',
  489 + 'num' => '0'
  490 + ),
501 array( 491 array(
502 - 'name' =>'我的YOHO币',  
503 - 'link' =>'',  
504 - 'num' => '1'  
505 - ), 492 + 'name' =>'我的收藏',
  493 + 'link' =>'',
  494 + 'num' => '1'
  495 + ),
506 array( 496 array(
507 - 'name' =>'我的退货换货',  
508 - 'link' =>'',  
509 - 'num' => '1'  
510 - )  
511 - ),  
512 - 'updlink' => ''  
513 - ),  
514 - 'gobuy'=> array(  
515 - 'gobuynum' =>3  
516 - ),  
517 - 'breadcrumbnav'=> array(  
518 - array(  
519 - 'notend'=>array(  
520 - 'link' => 'http=>//www.baidu.com',  
521 - 'name' => 'BOYS首页'  
522 - )  
523 - ),  
524 - array(  
525 - 'notend'=>array(  
526 - 'link' => 'http=>//www.baidu.com',  
527 - 'name' => '上衣'  
528 - )  
529 - ),  
530 - array(  
531 - 'isend'=>array(  
532 - 'link' => 'http=>//www.baidu.com',  
533 - 'name' => '衬衫'  
534 - )  
535 - )  
536 - ) 497 + 'name' =>'我的优惠券',
  498 + 'link' =>'',
  499 + 'num' => '2'
  500 + ),
  501 + array(
  502 + 'name' =>'我的YOHO币',
  503 + 'link' =>'',
  504 + 'num' => '1'
  505 + ),
  506 + array(
  507 + 'name' =>'我的退货换货',
  508 + 'link' =>'',
  509 + 'num' => '1'
  510 + )
  511 + ),
  512 + 'updlink' => ''
  513 + ),
  514 + 'gobuy'=> array(
  515 + 'gobuynum' =>3
  516 + ),
  517 + 'breadcrumbnav'=> array(
  518 + array(
  519 + 'notend'=>array(
  520 + 'link' => 'http=>//www.baidu.com',
  521 + 'name' => 'BOYS首页'
  522 + )
  523 + ),
  524 + array(
  525 + 'notend'=>array(
  526 + 'link' => 'http=>//www.baidu.com',
  527 + 'name' => '上衣'
  528 + )
  529 + ),
  530 + array(
  531 + 'isend'=>array(
  532 + 'link' => 'http=>//www.baidu.com',
  533 + 'name' => '衬衫'
  534 + )
  535 + )
  536 + )
537 ); 537 );
538 $this->_view->assign('headerdata', $header); 538 $this->_view->assign('headerdata', $header);
539 } 539 }
@@ -94,10 +94,10 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -94,10 +94,10 @@ class SearchData extends \LibModels\Wap\Product\SearchData
94 * @param integer $sell_channels 销售平台 94 * @param integer $sell_channels 销售平台
95 * @param integer $p_d_int 促销折扣 int型如7 95 * @param integer $p_d_int 促销折扣 int型如7
96 * @param integer $act_temp 活动模板 96 * @param integer $act_temp 活动模板
97 - * @param integer $act_rec 活动模板是否推荐  
98 - * @param integer $act_status 活动模板商品状态  
99 - * @param integer $attribute_not 过滤商品属性,attribute_not=2过滤掉赠品  
100 - * @param integer $not_* not_字段名,过滤字段 97 + * @param integer $act_rec 活动模板是否推荐
  98 + * @param integer $act_status 活动模板商品状态
  99 + * @param integer $attribute_not 过滤商品属性,attribute_not=2过滤掉赠品
  100 + * @param integer $not_* not_字段名,过滤字段
101 * @return array 搜索到的数据 101 * @return array 搜索到的数据
102 */ 102 */
103 public static function getClassesData($classes = array(), $cache = false) 103 public static function getClassesData($classes = array(), $cache = false)
@@ -142,7 +142,7 @@ function actionGoodsCart() { @@ -142,7 +142,7 @@ function actionGoodsCart() {
142 return false; 142 return false;
143 } 143 }
144 key = encodeURI(key); 144 key = encodeURI(key);
145 - $.get(searchDomain + '?callback=?&query=' + key, function(htmlData) { 145 + $.get(searchDomain + '?query=' + key, function(htmlData) {
146 $('.search-list').html(htmlData.data); 146 $('.search-list').html(htmlData.data);
147 queryNum = $('.search-list').children('li').length; 147 queryNum = $('.search-list').children('li').length;
148 listIndex = -1; 148 listIndex = -1;
@@ -156,7 +156,7 @@ function actionGoodsCart() { @@ -156,7 +156,7 @@ function actionGoodsCart() {
156 }, function() { 156 }, function() {
157 $(this).css('background-color', '#fff'); 157 $(this).css('background-color', '#fff');
158 }); 158 });
159 - }, 'jsonp'); 159 + }, 'json');
160 } 160 }
161 161
162 function getText(obj) { 162 function getText(obj) {
@@ -525,7 +525,7 @@ function createNewArray(obj) { @@ -525,7 +525,7 @@ function createNewArray(obj) {
525 var $that = $(this); 525 var $that = $(this);
526 var $alink = $that.find('a'); 526 var $alink = $that.find('a');
527 var _href = $alink.attr('href'); 527 var _href = $alink.attr('href');
528 - var hottag = $alink.attr('hot') === 'true' ? true : false; 528 + var hottag = $alink.attr('hot') === 'hot' ? true : false;
529 var objt = {}; 529 var objt = {};
530 530
531 if ($that.hasClass('category-title')) { 531 if ($that.hasClass('category-title')) {
@@ -721,7 +721,6 @@ function actionNav() { @@ -721,7 +721,6 @@ function actionNav() {
721 } 721 }
722 722
723 723
724 -  
725 /** 724 /**
726 * 查询跳转后保留关键字 725 * 查询跳转后保留关键字
727 * @return {[type]} [description] 726 * @return {[type]} [description]
@@ -1172,7 +1171,7 @@ function actionExeTemplate() { @@ -1172,7 +1171,7 @@ function actionExeTemplate() {
1172 * @return {[type]} [description] 1171 * @return {[type]} [description]
1173 */ 1172 */
1174 function actionSearch() { 1173 function actionSearch() {
1175 - var searchDomain = 'http://search.yohobuy.com/api/suggest'; 1174 + var searchDomain = 'http://search.yohobuy.com/product/search/suggest';
1176 1175
1177 $('#query_key').search(searchDomain); 1176 $('#query_key').search(searchDomain);
1178 } 1177 }
@@ -14,17 +14,19 @@ var $cr = $('#country-code-hide'), @@ -14,17 +14,19 @@ var $cr = $('#country-code-hide'),
14 emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/, 14 emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/,
15 acAccount = [ 15 acAccount = [
16 ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 16 ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com',
17 - 'sohu.com', 'hotmail.com', '139.com', '189.com'], //数字顺序 17 + 'sohu.com', 'hotmail.com', '139.com', '189.com'
  18 + ], //数字顺序
18 ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 19 ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com',
19 - 'sohu.com', 'hotmail.com', '139.com', '189.com'] //组合顺序 20 + 'sohu.com', 'hotmail.com', '139.com', '189.com'
  21 + ] //组合顺序
20 ], 22 ],
21 $ccList = $('#country-code-list'), 23 $ccList = $('#country-code-list'),
22 $cc = $('#country-code'), 24 $cc = $('#country-code'),
23 $btn = $('#find-btn'), 25 $btn = $('#find-btn'),
24 $accErr = $('#account-err'), 26 $accErr = $('#account-err'),
25 $caErr = $('#captcha-err'), 27 $caErr = $('#captcha-err'),
26 - time, //timeout-id  
27 - caCount = 4, //验证码位数 28 + time, //timeout-id
  29 + caCount = 4, //验证码位数
28 hasPh = false, 30 hasPh = false,
29 hasCa = false; 31 hasCa = false;
30 32
@@ -42,8 +44,9 @@ require('yoho.placeholder'); @@ -42,8 +44,9 @@ require('yoho.placeholder');
42 44
43 function imgcode() { 45 function imgcode() {
44 var time = new Date(), 46 var time = new Date(),
45 - $captchaImg = $('#captcha-img'),  
46 - captchaImgSrc = $captchaImg.attr('src').split('?')[0]; 47 + $captchaImg = $('#captcha-img'),
  48 + captchaImgSrc = $captchaImg.attr('src').split('?')[0];
  49 +
47 $('#captcha-img').attr('src', captchaImgSrc + '?t=' + time.getTime()); 50 $('#captcha-img').attr('src', captchaImgSrc + '?t=' + time.getTime());
48 51
49 //getSource('yoho_family_web', '换一张', 'homepage_man'); 52 //getSource('yoho_family_web', '换一张', 'homepage_man');
@@ -101,8 +104,8 @@ function vaCa() { @@ -101,8 +104,8 @@ function vaCa() {
101 type: 'POST', 104 type: 'POST',
102 url: '/passport/back/authcode', 105 url: '/passport/back/authcode',
103 data: { 106 data: {
104 - verifyCode: v,  
105 - phoneNum: $('#phone-num').val(), 107 + verifyCode: v,
  108 + phoneNum: $('#phone-num').val(),
106 area: $('#country-code-hide').val() 109 area: $('#country-code-hide').val()
107 } 110 }
108 111
@@ -80,7 +80,7 @@ class Bootstrap extends Bootstrap_Abstract @@ -80,7 +80,7 @@ class Bootstrap extends Bootstrap_Abstract
80 case 'web': 80 case 'web':
81 break; 81 break;
82 case 'search': // 搜索 82 case 'search': // 搜索
83 - $searchRequest = new Yaf\Request\Http('/product/search/index'); 83 + $searchRequest = new Yaf\Request\Http('/product/search/index');
84 $dispatcher->setRequest($searchRequest); 84 $dispatcher->setRequest($searchRequest);
85 break; 85 break;
86 case 'guang': // 逛 86 case 'guang': // 逛
@@ -90,7 +90,7 @@ class Bootstrap extends Bootstrap_Abstract @@ -90,7 +90,7 @@ class Bootstrap extends Bootstrap_Abstract
90 $module = 'Product'; 90 $module = 'Product';
91 $url = strtolower($dispatcher->getRequest()->getRequestUri()); 91 $url = strtolower($dispatcher->getRequest()->getRequestUri());
92 //list列表的index 92 //list列表的index
93 - if(empty($url) || $url == '/index' || $url == '/') { 93 + if(empty($url) || $url == '/index' || $url == '/') {
94 $listRequest = new Yaf\Request\Http('/product/list/index'); 94 $listRequest = new Yaf\Request\Http('/product/list/index');
95 $dispatcher->setRequest($listRequest); 95 $dispatcher->setRequest($listRequest);
96 } 96 }
@@ -85,6 +85,8 @@ class CommonController extends WebAction @@ -85,6 +85,8 @@ class CommonController extends WebAction
85 $content_code = $this->get('content_code', ''); 85 $content_code = $this->get('content_code', '');
86 $client_type = $this->get('client_type', 'web'); 86 $client_type = $this->get('client_type', 'web');
87 $callback = $this->get('callback', ''); 87 $callback = $this->get('callback', '');
  88 + $width = $this->get('width', '');
  89 + $height = $this->get('height', '');
88 $params = array( 90 $params = array(
89 'content_code' => $content_code, 91 'content_code' => $content_code,
90 'client_type' => $client_type 92 'client_type' => $client_type
@@ -96,16 +98,19 @@ class CommonController extends WebAction @@ -96,16 +98,19 @@ class CommonController extends WebAction
96 } 98 }
97 else 99 else
98 { 100 {
99 - $banner = '';  
100 - if(isset($data['data'][0]['data']))  
101 - {  
102 - $banner = current($data['data'][0]['data']);  
103 -  
104 - if(!empty($banner)) {  
105 - $banner['src'] = Images::getImageUrl($banner['src'], 2600, 60 ,2);  
106 - //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);  
107 - }  
108 - } 101 + $banner = '';
  102 + if(isset($data['data'][0]['data']))
  103 + {
  104 + $banner = current($data['data'][0]['data']);
  105 + if(!empty($banner)) {
  106 + if(empty($width) || empty($height) ) {
  107 + $width = 2600;//通栏广告
  108 + $height = 60;
  109 + }
  110 + $banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2);
  111 + //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
  112 + }
  113 + }
109 } 114 }
110 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner); 115 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
111 } 116 }
@@ -66,57 +66,60 @@ class HomeModel @@ -66,57 +66,60 @@ class HomeModel
66 $key = sprintf('%s_%s_%s',CacheConfig::KEY_WEB_HOME_NAVBAR_DATA, md5(serialize($data)), $channel); 66 $key = sprintf('%s_%s_%s',CacheConfig::KEY_WEB_HOME_NAVBAR_DATA, md5(serialize($data)), $channel);
67 $menu = Cache::get($key); 67 $menu = Cache::get($key);
68 if(empty($menu)) { 68 if(empty($menu)) {
69 - $item = array();  
70 - $index_main = 0;  
71 - foreach ($data['data'] as $val) {  
72 - $item = array(  
73 - 'name_cn' => $val['sort_name'], // 父级  
74 - 'name_en' => $val['sort_name_en'],  
75 - 'link' => $val['sort_url'],  
76 - 'icon' => $val['sort_ico'],  
77 - 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',  
78 - 'index_main' => $index_main++,  
79 - 'is_hot' => $val['is_hot'] == 'Y' ? true : false,  
80 - 'is_new' => $val['is_new'] == 'Y' ? true : false,  
81 - // 'subnav' => array()  
82 - );  
83 - $index_sub = 0;  
84 - foreach ($val['sub'] as $sub) { // 二级  
85 - $subnav = array(  
86 - 'name' => $sub['sort_name'],  
87 - 'name_en' => $sub['sort_name_en'],  
88 - 'link' => $sub['sort_url'],  
89 - 'is_hot' => $sub['is_hot'] == 'Y' ? true : false,  
90 - 'is_new' => $sub['is_new'] == 'Y' ? true : false,  
91 - // 'thirdnav' => array(),  
92 - 'index_sub' => $index_sub ++  
93 - );  
94 - if (isset($sub['sub'])) {  
95 - foreach ($sub['sub'] as $thirdsub) { // 三级  
96 - $thirdnav = array(  
97 - 'title' => $thirdsub['sort_name'],  
98 - 'name_en' => $thirdsub['sort_name_en'],  
99 - 'link' => $thirdsub['sort_url'],  
100 - // 'branditems' => array()  
101 - );  
102 - if (isset($thirdsub['sub'])) {  
103 - foreach ($thirdsub['sub'] as $fourthnav) { // 四级  
104 - $thirdnav['branditems'][] = array(  
105 - 'brandname' => $fourthnav['sort_name'],  
106 - 'link' => $fourthnav['sort_url'],  
107 - 'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''  
108 - );  
109 - }  
110 - }  
111 - $subnav['thirdnav'][] = $thirdnav;  
112 - }  
113 - }  
114 -  
115 - $item['subnav'][] = $subnav;  
116 - }  
117 - $menu[] = $item;  
118 - }  
119 - Cache::set($key, $menu, 3600); 69 + $item = array();
  70 + $index_main = 0;
  71 + foreach ($data['data'] as $val) {
  72 + $item = array(
  73 + 'name_cn' => $val['sort_name'], // 父级
  74 + 'name_en' => $val['sort_name_en'],
  75 + 'link' => $val['sort_url'],
  76 + 'icon' => $val['sort_ico'],
  77 + 'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
  78 + 'index_main' => $index_main ++,
  79 + 'content_code' => $val['content_code'],
  80 + 'is_hot' => $val['is_hot'] == 'Y' ? true : false,
  81 + 'is_new' => $val['is_new'] == 'Y' ? true : false,
  82 + // 'subnav' => array()
  83 + );
  84 + $index_sub = 0;
  85 + foreach ($val['sub'] as $sub) { // 二级
  86 + $subnav = array(
  87 + 'name' => $sub['sort_name'],
  88 + 'name_en' => $sub['sort_name_en'],
  89 + 'link' => $sub['sort_url'],
  90 + 'is_hot' => $sub['is_hot'] == 'Y' ? true : false,
  91 + 'is_new' => $sub['is_new'] == 'Y' ? true : false,
  92 + 'content_code' => $sub['content_code'],
  93 + // 'thirdnav' => array(),
  94 + 'index_sub' => $index_sub ++
  95 + );
  96 + if (isset($sub['sub'])) {
  97 + foreach ($sub['sub'] as $thirdsub) { // 三级
  98 + $thirdnav = array(
  99 + 'title' => $thirdsub['sort_name'],
  100 + 'name_en' => $thirdsub['sort_name_en'],
  101 + 'link' => $thirdsub['sort_url'],
  102 + 'content_code' => $thirdsub['content_code'],
  103 + // 'branditems' => array()
  104 + );
  105 + if (isset($thirdsub['sub'])) {
  106 + foreach ($thirdsub['sub'] as $fourthnav) { // 四级
  107 + $thirdnav['branditems'][] = array(
  108 + 'brandname' => $fourthnav['sort_name'],
  109 + 'link' => $fourthnav['sort_url'],
  110 + 'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''
  111 + );
  112 + }
  113 + }
  114 + $subnav['thirdnav'][] = $thirdnav;
  115 + }
  116 + }
  117 +
  118 + $item['subnav'][] = $subnav;
  119 + }
  120 + $menu[] = $item;
  121 + }
  122 + Cache::set($key, $menu, 3600);
120 } 123 }
121 return $menu; 124 return $menu;
122 } 125 }
@@ -171,14 +174,14 @@ class HomeModel @@ -171,14 +174,14 @@ class HomeModel
171 */ 174 */
172 public static function getChannelResource($channel, $content_code) 175 public static function getChannelResource($channel, $content_code)
173 { 176 {
174 - $key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);  
175 - $data = Cache::get($key);  
176 - if(empty($data)) {  
177 - $resource = IndexData::getResourceData($content_code);  
178 - // 格式化数据  
179 - $data = ChannelProcess::getFormat($channel, $resource['data']);  
180 - Cache::set($key, $data, 3600);  
181 - } 177 + $key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);
  178 + $data = Cache::get($key);
  179 + if(empty($data)) {
  180 + $resource = IndexData::getResourceData($content_code);
  181 + // 格式化数据
  182 + $data = ChannelProcess::getFormat($channel, $resource['data']);
  183 + Cache::set($key, $data, 3600);
  184 + }
182 return $data; 185 return $data;
183 } 186 }
184 187
@@ -228,47 +231,47 @@ class HomeModel @@ -228,47 +231,47 @@ class HomeModel
228 //缓存数据 231 //缓存数据
229 $result = Cache::get($key); 232 $result = Cache::get($key);
230 if(empty($result)) { 233 if(empty($result)) {
231 - $params = array(  
232 - 'order' => 's_t_desc',  
233 - 'shelve_time' => strtotime("-60 days") . ',' . time()  
234 - );  
235 - //男首频道最新上架参数是gender=1,3  
236 - if($channel == self::COOKIE_NAME_BOYS) {  
237 - $params['gender'] = '1,3';  
238 - }  
239 - //女首频道最新上架参数是gender=2,3  
240 - else if($channel == self::COOKIE_NAME_GIRLS) {  
241 - $params['gender'] = '2,3';  
242 - }  
243 - // 最新上架分类  
244 - if (isset(ChannelConfig::$newArrivalSortList[$channel])) {  
245 - $sortList = ChannelConfig::$newArrivalSortList[$channel];  
246 - // 获取分类列表获取商品信息  
247 - $goodsList = SearchData::getSearchDataBySort($params, $sortList);  
248 - $pos = 1;  
249 - foreach ($goodsList as $goods) {  
250 - // 格式化数据  
251 - $val = Helpers::formatProduct($goods, true, true, true, 280, 373);  
252 - if ($val['price'] == false) {  
253 - $val['price'] = $val['salePrice'];  
254 - }  
255 - $val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);  
256 - //TODO 字段要调整  
257 - $val['isFew'] = $val['is_soon_sold_out'];  
258 - $val['tags']['isLimit'] = $val['tags']['is_limited'];  
259 - $val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示  
260 - $val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示  
261 - $val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];  
262 - $val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];  
263 - $val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示  
264 - unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],  
265 - $val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);  
266 - if (! empty($val)) {  
267 - $result[] = $val;  
268 - }  
269 - }  
270 - }  
271 - Cache::set($key, $result, 3600); 234 + $params = array(
  235 + 'order' => 's_t_desc',
  236 + 'shelve_time' => strtotime("-60 days") . ',' . time()
  237 + );
  238 + //男首频道最新上架参数是gender=1,3
  239 + if($channel == self::COOKIE_NAME_BOYS) {
  240 + $params['gender'] = '1,3';
  241 + }
  242 + //女首频道最新上架参数是gender=2,3
  243 + else if($channel == self::COOKIE_NAME_GIRLS) {
  244 + $params['gender'] = '2,3';
  245 + }
  246 + // 最新上架分类
  247 + if (isset(ChannelConfig::$newArrivalSortList[$channel])) {
  248 + $sortList = ChannelConfig::$newArrivalSortList[$channel];
  249 + // 获取分类列表获取商品信息
  250 + $goodsList = SearchData::getSearchDataBySort($params, $sortList);
  251 + $pos = 1;
  252 + foreach ($goodsList as $goods) {
  253 + // 格式化数据
  254 + $val = Helpers::formatProduct($goods, true, true, true, 280, 373);
  255 + if ($val['price'] == false) {
  256 + $val['price'] = $val['salePrice'];
  257 + }
  258 + $val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);
  259 + //TODO 字段要调整
  260 + $val['isFew'] = $val['is_soon_sold_out'];
  261 + $val['tags']['isLimit'] = $val['tags']['is_limited'];
  262 + $val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示
  263 + $val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示
  264 + $val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];
  265 + $val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];
  266 + $val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示
  267 + unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],
  268 + $val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);
  269 + if (! empty($val)) {
  270 + $result[] = $val;
  271 + }
  272 + }
  273 + }
  274 + Cache::set($key, $result, 3600);
272 } 275 }
273 return $result; 276 return $result;
274 } 277 }
@@ -6,225 +6,225 @@ use Plugin\Helpers; @@ -6,225 +6,225 @@ use Plugin\Helpers;
6 use LibModels\Wap\Passport\BackData; 6 use LibModels\Wap\Passport\BackData;
7 use Plugin\AuthCode; 7 use Plugin\AuthCode;
8 class BackController extends WebAction { 8 class BackController extends WebAction {
9 -  
10 - /**  
11 - * 找回密码  
12 - */  
13 - public function indexAction() {  
14 - $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);  
15 - $data = array (  
16 - 'simpleHeader' => PassportModel::getSimpleHeader(false),  
17 - 'backPage' => true,  
18 - 'back' => array (  
19 - 'coverHref' => $banner ['url'],  
20 - 'coverImg' => $banner ['img'],  
21 - 'countryCode' => '86',  
22 - 'countryName' => '中国',  
23 - 'captchaUrl' => '/passport/images?t=1449799445',  
24 - 'countryList' => RegData::getAreasData()  
25 - )  
26 - );  
27 - $this->_view->display ( 'index', $data );  
28 - }  
29 -  
30 - /**  
31 - * 校验验证码  
32 - */  
33 - public function authcodeAction() {  
34 - $phoneNum = $this->post ('phoneNum', '');  
35 - $area = intval ($this->post( 'area', '86' ));  
36 - $verifyCode = $this->post ('verifyCode', '');  
37 - $data = array('code' => 400, 'message' =>'验证失败');  
38 - if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))  
39 - && PassportModel::verifyCode($verifyCode)) {  
40 - $data['code'] = 200;  
41 - $data['message'] = '验证成功';  
42 - }  
43 - echo $this->echoJson($data);  
44 - }  
45 -  
46 - /**  
47 - * 邮箱  
48 - */  
49 - public function emailAction() {  
50 - $phoneNum = $this->post ('phoneNum', '');  
51 - $area = intval ($this->post('area', '86'));  
52 - $verifyCode = $this->post('verifyCode', '');  
53 - if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱  
54 - $email = $phoneNum;  
55 - $data = BackData::sendCodeToEmail($email);  
56 - if ($data ['code'] == 200) {  
57 - $this->setSession('email', $email);  
58 - $this->redirect ('sendemail');  
59 - } else {  
60 - $this->redirect ('index');  
61 - }  
62 -  
63 - } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号  
64 - $mobile = $phoneNum;  
65 - $data = BackData::sendCodeToMobile($mobile, $area);  
66 - if ($data['code'] == 200) {  
67 - $this->setSession ('mobile', $mobile );  
68 - $this->setSession ('area', $area );  
69 - $this->setSession ('verifyCode', $verifyCode );  
70 - $this->redirect ('verification');  
71 - } else {  
72 - $this->redirect ('index');  
73 - }  
74 - }  
75 - }  
76 -  
77 - /**  
78 - * 发送邮件页面  
79 - */  
80 - public function sendemailAction() {  
81 - $email = $this->getSession ('email');  
82 - if (empty ( $email )) {  
83 - $this->redirect ('index');  
84 - }  
85 - $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);  
86 - $data = array (  
87 - 'simpleHeader' => PassportModel::getSimpleHeader(false),  
88 - 'sendEmail' => array (  
89 - 'coverHref' => $banner ['url'],  
90 - 'coverImg' => $banner ['img'],  
91 - 'countrys' => array ()  
92 - )  
93 - );  
94 - $this->_view->display('send-email', $data);  
95 - }  
96 -  
97 - /**  
98 - * 重置密码页面  
99 - */  
100 - public function backcodeAction() {  
101 - $code = $this->get('code');  
102 - $info = $this->checkCode($code);  
103 - if (empty ( $info )) {  
104 - $this->redirect ('index');  
105 - }  
106 - $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);  
107 - $data = array (  
108 - 'simpleHeader' => PassportModel::getSimpleHeader(false),  
109 - 'resetPage' => true,  
110 - 'resetPwd' => array (  
111 - 'coverHref' => $banner ['url'],  
112 - 'coverImg' => $banner ['img'],  
113 - 'countrys' => array(),  
114 - 'code' => $code  
115 - )  
116 - );  
117 - $this->_view->display('reset-pwd', $data);  
118 - }  
119 -  
120 - /**  
121 - * 更新密码接口  
122 - */  
123 - public function updateAction() {  
124 - $code = $this->post('code');  
125 - $password = $this->post('pwd');  
126 - $info = $this->checkCode($code);  
127 - if (Helpers::verifyPassword ($password) && ! empty ($info)) {  
128 - // 修改密码  
129 - if (isset ( $info ['mobile'] )) { // 手机号修改密码  
130 - $mobile = $info ['mobile'];  
131 - $token = $info ['token'];  
132 - $area = $info ['area'];  
133 - $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);  
134 - if ($data ['code'] == 200) {  
135 - $this->redirect ( 'resetSuccess' );  
136 - }  
137 - } else if (isset ($info ['uid'])) { // 其他方式修改密码  
138 - $uid = $info ['uid'];  
139 - $this->redirect ( 'resetSuccess' );  
140 - }  
141 - }  
142 - // 跳转错误页面  
143 - $this->redirect('/error/index');  
144 - }  
145 -  
146 - /**  
147 - * 重置密码成功  
148 - */  
149 - public function resetSuccessAction() {  
150 - $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );  
151 - $data = array (  
152 - 'simpleHeader' => PassportModel::getSimpleHeader ( false ),  
153 - 'resetSuccess' => array (  
154 - 'coverHref' => $banner ['url'],  
155 - 'coverImg' => $banner ['img'],  
156 - 'countrys' => array ()  
157 - )  
158 - );  
159 - $this->_view->display ( 'reset-success', $data );  
160 - }  
161 -  
162 - /**  
163 - * 手机验证页面  
164 - */  
165 - public function verificationAction() {  
166 - $mobile = $this->getSession ('mobile');  
167 - $area = $this->getSession ('area');  
168 - $verifyCode = $this->getSession ('verifyCode');  
169 - if (empty ($mobile)) {  
170 - $this->redirect ('index');  
171 - }  
172 - $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);  
173 - $data = array (  
174 - 'simpleHeader' => PassportModel::getSimpleHeader ( false ),  
175 - 'vertificationPage' => true,  
176 - 'verification' => array (  
177 - 'coverHref' => $banner ['url'],  
178 - 'coverImg' => $banner ['img'],  
179 - 'mobile' => $mobile,  
180 - 'area' => $area,  
181 - 'verifyCode' => $verifyCode,  
182 - 'countrys' => array ()  
183 - )  
184 - );  
185 - $this->_view->display ('verification', $data);  
186 - }  
187 -  
188 - /**  
189 - * 手机找回密码验证  
190 - */  
191 - public function backmobileAction() {  
192 - $mobile = $this->post ( 'mobile' );  
193 - $area = $this->post ( 'area' );  
194 - $verifyCode = $this->post ( 'verifyCode' );  
195 - $code = $this->post ( 'code' ); // code  
196 - if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {  
197 - $result = BackData::validateMobileCode ( $mobile, $code, $area );  
198 - if ($result ['code'] == 200) {  
199 - $str = json_encode ( array (  
200 - 'mobile' => $mobile,  
201 - 'area' => $area,  
202 - 'token' => $result ['data'] ['token'],  
203 - 'create_time' => time ()  
204 - ) );  
205 - $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );  
206 - $url = '/passport/back/backcode?code=' . base64_encode ( $code );  
207 - $this->redirect ( SITE_MAIN . $url );  
208 - return true;  
209 - }  
210 - }  
211 - //出错直接跳到找回密码页  
212 - $this->redirect ('/passport/back/index');  
213 - }  
214 -  
215 - /**  
216 - * 检查code  
217 - *  
218 - * @param string $code  
219 - * @return boolean  
220 - */  
221 - private function checkCode($code) {  
222 - $code = base64_decode ( $code );  
223 - $info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );  
224 - if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {  
225 - return array ();  
226 - }  
227 - return $info;  
228 - } 9 +
  10 + /**
  11 + * 找回密码
  12 + */
  13 + public function indexAction() {
  14 + $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
  15 + $data = array (
  16 + 'simpleHeader' => PassportModel::getSimpleHeader(false),
  17 + 'backPage' => true,
  18 + 'back' => array (
  19 + 'coverHref' => $banner ['url'],
  20 + 'coverImg' => $banner ['img'],
  21 + 'countryCode' => '86',
  22 + 'countryName' => '中国',
  23 + 'captchaUrl' => '/passport/images?t=1449799445',
  24 + 'countryList' => RegData::getAreasData()
  25 + )
  26 + );
  27 + $this->_view->display ( 'index', $data );
  28 + }
  29 +
  30 + /**
  31 + * 校验验证码
  32 + */
  33 + public function authcodeAction() {
  34 + $phoneNum = $this->post ('phoneNum', '');
  35 + $area = intval ($this->post( 'area', '86' ));
  36 + $verifyCode = $this->post ('verifyCode', '');
  37 + $data = array('code' => 400, 'message' =>'验证失败');
  38 + if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
  39 + && PassportModel::verifyCode($verifyCode)) {
  40 + $data['code'] = 200;
  41 + $data['message'] = '验证成功';
  42 + }
  43 + echo $this->echoJson($data);
  44 + }
  45 +
  46 + /**
  47 + * 邮箱
  48 + */
  49 + public function emailAction() {
  50 + $phoneNum = $this->post ('phoneNum', '');
  51 + $area = intval ($this->post('area', '86'));
  52 + $verifyCode = $this->post('verifyCode', '');
  53 + if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
  54 + $email = $phoneNum;
  55 + $data = BackData::sendCodeToEmail($email);
  56 + if ($data ['code'] == 200) {
  57 + $this->setSession('email', $email);
  58 + $this->redirect ('sendemail');
  59 + } else {
  60 + $this->redirect ('index');
  61 + }
  62 +
  63 + } else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
  64 + $mobile = $phoneNum;
  65 + $data = BackData::sendCodeToMobile($mobile, $area);
  66 + if ($data['code'] == 200) {
  67 + $this->setSession ('mobile', $mobile );
  68 + $this->setSession ('area', $area );
  69 + $this->setSession ('verifyCode', $verifyCode );
  70 + $this->redirect ('verification');
  71 + } else {
  72 + $this->redirect ('index');
  73 + }
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 发送邮件页面
  79 + */
  80 + public function sendemailAction() {
  81 + $email = $this->getSession ('email');
  82 + if (empty ( $email )) {
  83 + $this->redirect ('index');
  84 + }
  85 + $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
  86 + $data = array (
  87 + 'simpleHeader' => PassportModel::getSimpleHeader(false),
  88 + 'sendEmail' => array (
  89 + 'coverHref' => $banner ['url'],
  90 + 'coverImg' => $banner ['img'],
  91 + 'countrys' => array ()
  92 + )
  93 + );
  94 + $this->_view->display('send-email', $data);
  95 + }
  96 +
  97 + /**
  98 + * 重置密码页面
  99 + */
  100 + public function backcodeAction() {
  101 + $code = $this->get('code');
  102 + $info = $this->checkCode($code);
  103 + if (empty ( $info )) {
  104 + $this->redirect ('index');
  105 + }
  106 + $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
  107 + $data = array (
  108 + 'simpleHeader' => PassportModel::getSimpleHeader(false),
  109 + 'resetPage' => true,
  110 + 'resetPwd' => array (
  111 + 'coverHref' => $banner ['url'],
  112 + 'coverImg' => $banner ['img'],
  113 + 'countrys' => array(),
  114 + 'code' => $code
  115 + )
  116 + );
  117 + $this->_view->display('reset-pwd', $data);
  118 + }
  119 +
  120 + /**
  121 + * 更新密码接口
  122 + */
  123 + public function updateAction() {
  124 + $code = $this->post('code');
  125 + $password = $this->post('pwd');
  126 + $info = $this->checkCode($code);
  127 + if (Helpers::verifyPassword ($password) && ! empty ($info)) {
  128 + // 修改密码
  129 + if (isset ( $info ['mobile'] )) { // 手机号修改密码
  130 + $mobile = $info ['mobile'];
  131 + $token = $info ['token'];
  132 + $area = $info ['area'];
  133 + $data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
  134 + if ($data ['code'] == 200) {
  135 + $this->redirect ( 'resetSuccess' );
  136 + }
  137 + } else if (isset ($info ['uid'])) { // 其他方式修改密码
  138 + $uid = $info ['uid'];
  139 + $this->redirect ( 'resetSuccess' );
  140 + }
  141 + }
  142 + // 跳转错误页面
  143 + $this->redirect('/error/index');
  144 + }
  145 +
  146 + /**
  147 + * 重置密码成功
  148 + */
  149 + public function resetSuccessAction() {
  150 + $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
  151 + $data = array (
  152 + 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
  153 + 'resetSuccess' => array (
  154 + 'coverHref' => $banner ['url'],
  155 + 'coverImg' => $banner ['img'],
  156 + 'countrys' => array ()
  157 + )
  158 + );
  159 + $this->_view->display ( 'reset-success', $data );
  160 + }
  161 +
  162 + /**
  163 + * 手机验证页面
  164 + */
  165 + public function verificationAction() {
  166 + $mobile = $this->getSession ('mobile');
  167 + $area = $this->getSession ('area');
  168 + $verifyCode = $this->getSession ('verifyCode');
  169 + if (empty ($mobile)) {
  170 + $this->redirect ('index');
  171 + }
  172 + $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
  173 + $data = array (
  174 + 'simpleHeader' => PassportModel::getSimpleHeader ( false ),
  175 + 'vertificationPage' => true,
  176 + 'verification' => array (
  177 + 'coverHref' => $banner ['url'],
  178 + 'coverImg' => $banner ['img'],
  179 + 'mobile' => $mobile,
  180 + 'area' => $area,
  181 + 'verifyCode' => $verifyCode,
  182 + 'countrys' => array ()
  183 + )
  184 + );
  185 + $this->_view->display ('verification', $data);
  186 + }
  187 +
  188 + /**
  189 + * 手机找回密码验证
  190 + */
  191 + public function backmobileAction() {
  192 + $mobile = $this->post ( 'mobile' );
  193 + $area = $this->post ( 'area' );
  194 + $verifyCode = $this->post ( 'verifyCode' );
  195 + $code = $this->post ( 'code' ); // code
  196 + if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
  197 + $result = BackData::validateMobileCode ( $mobile, $code, $area );
  198 + if ($result ['code'] == 200) {
  199 + $str = json_encode ( array (
  200 + 'mobile' => $mobile,
  201 + 'area' => $area,
  202 + 'token' => $result ['data'] ['token'],
  203 + 'create_time' => time ()
  204 + ) );
  205 + $code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
  206 + $url = '/passport/back/backcode?code=' . base64_encode ( $code );
  207 + $this->redirect ( SITE_MAIN . $url );
  208 + return true;
  209 + }
  210 + }
  211 + //出错直接跳到找回密码页
  212 + $this->redirect ('/passport/back/index');
  213 + }
  214 +
  215 + /**
  216 + * 检查code
  217 + *
  218 + * @param string $code
  219 + * @return boolean
  220 + */
  221 + private function checkCode($code) {
  222 + $code = base64_decode ( $code );
  223 + $info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
  224 + if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
  225 + return array ();
  226 + }
  227 + return $info;
  228 + }
229 229
230 } 230 }