Authored by yangyang

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

@@ -32,7 +32,7 @@ class AliwapConfig @@ -32,7 +32,7 @@ class AliwapConfig
32 * Enter description here ... 32 * Enter description here ...
33 * @var String 33 * @var String
34 */ 34 */
35 - var $notify_url = 'http://testservice.yoho.cn:28077/payment/alipay_notify';//"http://m.yohobuy.com/shopping/pay/aliwapnotice"; 35 + var $notify_url = 'http://testservice.yoho.cn:28077/payment/alipaywap_notify';//"http://m.yohobuy.com/shopping/pay/aliwapnotice";
36 36
37 /** 37 /**
38 * 浏览器的返回 38 * 浏览器的返回
@@ -71,8 +71,7 @@ class HelperSearch @@ -71,8 +71,7 @@ class HelperSearch
71 $result = array(); 71 $result = array();
72 self::$params = $_GET; 72 self::$params = $_GET;
73 self::$options = $options; 73 self::$options = $options;
74 -// unset(self::$params['/']);  
75 -// unset(self::$params['page']); 74 + unset(self::$params['page']);
76 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array(); 75 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
77 //产品列表 76 //产品列表
78 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array(); 77 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array();
@@ -555,6 +554,7 @@ class HelperSearch @@ -555,6 +554,7 @@ class HelperSearch
555 $result = array(); 554 $result = array();
556 $color = $filter['color']; 555 $color = $filter['color'];
557 foreach ($color as $v) { 556 foreach ($color as $v) {
  557 + $checked = false;
558 //设置已选中 558 //设置已选中
559 if ($v['color_id'] == $colorId) { 559 if ($v['color_id'] == $colorId) {
560 $background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")"; 560 $background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")";
@@ -562,6 +562,7 @@ class HelperSearch @@ -562,6 +562,7 @@ class HelperSearch
562 'color' => $background, 562 'color' => $background,
563 'href' => self::buildUrl($params) 563 'href' => self::buildUrl($params)
564 ); 564 );
  565 + $checked = true;
565 } 566 }
566 $result[] = array( 567 $result[] = array(
567 'name' => $v['color_name'], 568 'name' => $v['color_name'],
@@ -569,6 +570,7 @@ class HelperSearch @@ -569,6 +570,7 @@ class HelperSearch
569 'href' => self::buildUrl(array_merge($params, array( 570 'href' => self::buildUrl(array_merge($params, array(
570 'color' => $v['color_id'] 571 'color' => $v['color_id']
571 ))) , 572 ))) ,
  573 + 'checked' => $checked
572 ); 574 );
573 } 575 }
574 if (self::checkSearch('color')) { 576 if (self::checkSearch('color')) {
@@ -663,6 +665,7 @@ class HelperSearch @@ -663,6 +665,7 @@ class HelperSearch
663 $styleNum = 0; 665 $styleNum = 0;
664 $styleName = ''; 666 $styleName = '';
665 foreach ($style as $v) { 667 foreach ($style as $v) {
  668 + $checked = false;
666 //选中的筛选条件 669 //选中的筛选条件
667 if (in_array($v['style_id'], $styleIds)) { 670 if (in_array($v['style_id'], $styleIds)) {
668 if (!$styleNum) { 671 if (!$styleNum) {
@@ -681,6 +684,7 @@ class HelperSearch @@ -681,6 +684,7 @@ class HelperSearch
681 $url = self::buildUrl(array_merge($params, array( 684 $url = self::buildUrl(array_merge($params, array(
682 'style' => implode(',', $selectedStyle) 685 'style' => implode(',', $selectedStyle)
683 ))); 686 )));
  687 + $checked = true;
684 } 688 }
685 //该风格url参数中添加该风格的id 689 //该风格url参数中添加该风格的id
686 else { 690 else {
@@ -693,6 +697,7 @@ class HelperSearch @@ -693,6 +697,7 @@ class HelperSearch
693 'id' => $v['style_id'], 697 'id' => $v['style_id'],
694 'name' => $v['style_name'], 698 'name' => $v['style_name'],
695 'href' => $url, 699 'href' => $url,
  700 + 'checked' => $checked
696 ); 701 );
697 } 702 }
698 if (isset(self::$params['style']) && !empty(self::$params['style'])) { 703 if (isset(self::$params['style']) && !empty(self::$params['style'])) {
@@ -1281,16 +1286,41 @@ class HelperSearch @@ -1281,16 +1286,41 @@ class HelperSearch
1281 */ 1286 */
1282 public static function fromPram($url, $position, $abEnabled = false) 1287 public static function fromPram($url, $position, $abEnabled = false)
1283 { 1288 {
  1289 + $type = '';
1284 $itemFrom = ChannelConfig::$itemFromStats; 1290 $itemFrom = ChannelConfig::$itemFromStats;
  1291 +
1285 $controller = isset(self::$options['controller']) ? strtolower(self::$options['controller']) : ''; 1292 $controller = isset(self::$options['controller']) ? strtolower(self::$options['controller']) : '';
1286 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : ''; 1293 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : '';
  1294 + //列表页面
  1295 + if ($controller == 'list' && $action == 'index') {
  1296 + $type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : '';
  1297 + }
  1298 + //新品到着
  1299 + elseif ($controller == 'list' && $action == 'new') {
  1300 + if (isset(self::$params['shelve_time'])) {
  1301 + $date = explode(',', self::$params['shelve_time']);
  1302 + $date = date('Y-m-d', $date[0]);
  1303 + }
  1304 + $type = $date;
  1305 + }
  1306 + //list - sale
  1307 + elseif ($controller == 'list' && $action == 'sale') {
  1308 + $type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
  1309 + }
  1310 + // 品牌
  1311 + elseif ($controller == 'list' && $action == 'sale') {
  1312 + $type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
  1313 + }
  1314 + // 搜索
  1315 + elseif ($controller == 'search') {
  1316 + $type = isset(self::$params['query']) && self::$params['query'] ? self::$params['query'] : '';
  1317 + }
1287 $itemIndex = $controller."_".$action; 1318 $itemIndex = $controller."_".$action;
1288 //获取domain-module-$keyword_page_position{ab} 1319 //获取domain-module-$keyword_page_position{ab}
1289 $ab = (isset($_COOKIE['ab_5']) && $abEnabled == true) ? '_'.$_COOKIE['ab_5'] : ''; 1320 $ab = (isset($_COOKIE['ab_5']) && $abEnabled == true) ? '_'.$_COOKIE['ab_5'] : '';
1290 $page = self::$page; 1321 $page = self::$page;
1291 - $keyword = isset(self::$options['query']) ? self::$options['query'] : '';  
1292 if (isset($itemFrom[$itemIndex])) { 1322 if (isset($itemFrom[$itemIndex])) {
1293 - $url .= "?from={$itemFrom[$itemIndex]['domain']}-{$itemFrom[$itemIndex]['module']}-{$keyword}_{$page}_{$position}{$ab}"; 1323 + $url .= "?from={$itemFrom[$itemIndex]['domain']}-{$itemFrom[$itemIndex]['module']}-{$type}_{$page}_{$position}{$ab}";
1294 } 1324 }
1295 return $url; 1325 return $url;
1296 } 1326 }
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 var $ = require('yoho.jquery'); 6 var $ = require('yoho.jquery');
7 7
8 require('./footer'); 8 require('./footer');
9 -require('./simple-header'); 9 +
  10 +
10 11
11 12
12 function cookie(name) { 13 function cookie(name) {
@@ -131,5 +132,9 @@ window.getUser = getUser; @@ -131,5 +132,9 @@ window.getUser = getUser;
131 window.getUid = getUid; 132 window.getUid = getUid;
132 133
133 window.getShoppingKey = getShoppingKey; 134 window.getShoppingKey = getShoppingKey;
  135 +if($('.simple-header').hasClass('simple-header')){
  136 + require('./simple-header');
  137 +}else{
  138 + require('./header');
  139 +}
134 140
135 -require('./header');  
@@ -773,8 +773,8 @@ function actionTipPic() { @@ -773,8 +773,8 @@ function actionTipPic() {
773 var $img = ''; 773 var $img = '';
774 var $title = ''; 774 var $title = '';
775 var $link = ''; 775 var $link = '';
776 - var link = '';  
777 - 776 + var logolink = '';
  777 +
778 $(document).on('mouseenter', '.sub-nav-item', function() { 778 $(document).on('mouseenter', '.sub-nav-item', function() {
779 $contentcode = $(this).find('.showdetail').attr('data-code'); 779 $contentcode = $(this).find('.showdetail').attr('data-code');
780 if ($contentcode) { 780 if ($contentcode) {
@@ -791,7 +791,7 @@ function actionTipPic() { @@ -791,7 +791,7 @@ function actionTipPic() {
791 } 791 }
792 } 792 }
793 }); 793 });
794 - link = $('.first-nav-list .cur').find('a').attr('href'); 794 + logolink = $('.first-nav-list .cur').find('a').attr('href');
795 $('.main-link').attr('href', link); 795 $('.main-link').attr('href', link);
796 } 796 }
797 797
@@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" @@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application"
4 ;;website library 4 ;;website library
5 application.library = ROOT_PATH "/library" 5 application.library = ROOT_PATH "/library"
6 ;;模块配置 6 ;;模块配置
7 -application.modules = "Index,Category,Channel,Guang,Passport,Product,Cart,Shopping" 7 +application.modules = "Index,Category,Channel,Guang,Passport,Product,Cart"
8 ;;加载 8 ;;加载
9 application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" 9 application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php"
10 ;;view文件的扩展名 10 ;;view文件的扩展名
@@ -6,6 +6,7 @@ use LibModels\Web\Passport\LoginData; @@ -6,6 +6,7 @@ use LibModels\Web\Passport\LoginData;
6 use Passport\PassportModel as PassportModel; 6 use Passport\PassportModel as PassportModel;
7 use Configs\ChannelConfig; 7 use Configs\ChannelConfig;
8 use WebPlugin\Helpers; 8 use WebPlugin\Helpers;
  9 +use WebPlugin\Cache;
9 10
10 class LoginController extends WebAction 11 class LoginController extends WebAction
11 { 12 {
@@ -61,8 +62,7 @@ class LoginController extends WebAction @@ -61,8 +62,7 @@ class LoginController extends WebAction
61 */ 62 */
62 public function authAction() 63 public function authAction()
63 { 64 {
64 - $data = array('code' => 400, 'message' => '账号或密码不正确', 'data' => '');  
65 - 65 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
66 do { 66 do {
67 /* 判断是不是AJAX请求 */ 67 /* 判断是不是AJAX请求 */
68 if (!$this->isAjax()) { 68 if (!$this->isAjax()) {
@@ -91,10 +91,29 @@ class LoginController extends WebAction @@ -91,10 +91,29 @@ class LoginController extends WebAction
91 break; 91 break;
92 } 92 }
93 93
94 - /* 调用登录接口进行登录 */ 94 + /* 购物车 */
95 $shoppingKey = Helpers::getShoppingKeyByCookie(); 95 $shoppingKey = Helpers::getShoppingKeyByCookie();
  96 + /*
  97 + * 登录-防恶意机制
  98 + * 同一用户名登录密码错误次数超10次,需30分钟后尝试
  99 + * 同一ip登录密码错误次数超100次,需1小时后尝试 , ip错误提示语:您尝试的次数过多,账号已被暂时锁定,请稍后再试
  100 + */
  101 + $ip = Helpers::getClientIp();
  102 + $ipKey = md5('ip_signin_' . $ip);
  103 + $accountKey = md5('account_signin_' . $account);
  104 + $accountTimes = Cache::increment($accountKey, 1, 0, 1800);
  105 + $ipTimes = Cache::increment($ipKey, 1, 0, 3600);
  106 + if ($accountTimes > 10) {
  107 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
  108 + break;
  109 + }
  110 + if ($ipTimes > 100) {
  111 + $data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => '');
  112 + break;
  113 + }
96 $data = LoginData::signin($area, $account, $password, $shoppingKey); 114 $data = LoginData::signin($area, $account, $password, $shoppingKey);
97 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { 115 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
  116 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
98 break; 117 break;
99 } 118 }
100 119
@@ -59,7 +59,7 @@ class RegisterController extends WebAction @@ -59,7 +59,7 @@ class RegisterController extends WebAction
59 $data['message'] = '手机号码格式不正确'; 59 $data['message'] = '手机号码格式不正确';
60 break; 60 break;
61 } 61 }
62 - if ($ip_times >= 1000) { 62 + if ($ip_times >= 500) {
63 $data['message'] = '由于你IP受限无法注册'; 63 $data['message'] = '由于你IP受限无法注册';
64 break; 64 break;
65 } 65 }
@@ -6,8 +6,8 @@ class SearchController extends WebAction @@ -6,8 +6,8 @@ class SearchController extends WebAction
6 public function indexAction() 6 public function indexAction()
7 { 7 {
8 //当前控制器 8 //当前控制器
9 - $options['controller'] = $this->_request->controller;  
10 - $options['action'] = $this->_request->action; 9 + $options['controller'] = 'Search';
  10 + $options['action'] = 'index';
11 //浏览记录数 11 //浏览记录数
12 $options['reviewNum'] = 7; 12 $options['reviewNum'] = 7;
13 $searchData = SearchModel::searchData(array(),$options); 13 $searchData = SearchModel::searchData(array(),$options);
@@ -16,8 +16,6 @@ class SearchController extends WebAction @@ -16,8 +16,6 @@ class SearchController extends WebAction
16 'searchListPage' => true, 16 'searchListPage' => true,
17 'search' => $searchData 17 'search' => $searchData
18 ); 18 );
19 -// $this->setTitle();  
20 -// $this->setTitle();  
21 $this->setWebNavHeader(); 19 $this->setWebNavHeader();
22 $this->_view->display('search', $data); 20 $this->_view->display('search', $data);
23 } 21 }