Authored by wangqing

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

@@ -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 * 浏览器的返回
@@ -74,8 +74,7 @@ class HelperSearch @@ -74,8 +74,7 @@ class HelperSearch
74 $result = array(); 74 $result = array();
75 self::$params = $_GET; 75 self::$params = $_GET;
76 self::$options = $options; 76 self::$options = $options;
77 -// unset(self::$params['/']);  
78 -// unset(self::$params['page']); 77 + unset(self::$params['page']);
79 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array(); 78 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
80 //产品列表 79 //产品列表
81 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array(); 80 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array();
@@ -558,6 +557,7 @@ class HelperSearch @@ -558,6 +557,7 @@ class HelperSearch
558 $result = array(); 557 $result = array();
559 $color = $filter['color']; 558 $color = $filter['color'];
560 foreach ($color as $v) { 559 foreach ($color as $v) {
  560 + $checked = false;
561 //设置已选中 561 //设置已选中
562 if ($v['color_id'] == $colorId) { 562 if ($v['color_id'] == $colorId) {
563 $background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")"; 563 $background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")";
@@ -565,6 +565,7 @@ class HelperSearch @@ -565,6 +565,7 @@ class HelperSearch
565 'color' => $background, 565 'color' => $background,
566 'href' => self::buildUrl($params) 566 'href' => self::buildUrl($params)
567 ); 567 );
  568 + $checked = true;
568 } 569 }
569 $result[] = array( 570 $result[] = array(
570 'name' => $v['color_name'], 571 'name' => $v['color_name'],
@@ -572,6 +573,7 @@ class HelperSearch @@ -572,6 +573,7 @@ class HelperSearch
572 'href' => self::buildUrl(array_merge($params, array( 573 'href' => self::buildUrl(array_merge($params, array(
573 'color' => $v['color_id'] 574 'color' => $v['color_id']
574 ))) , 575 ))) ,
  576 + 'checked' => $checked
575 ); 577 );
576 } 578 }
577 if (self::checkSearch('color')) { 579 if (self::checkSearch('color')) {
@@ -666,6 +668,7 @@ class HelperSearch @@ -666,6 +668,7 @@ class HelperSearch
666 $styleNum = 0; 668 $styleNum = 0;
667 $styleName = ''; 669 $styleName = '';
668 foreach ($style as $v) { 670 foreach ($style as $v) {
  671 + $checked = false;
669 //选中的筛选条件 672 //选中的筛选条件
670 if (in_array($v['style_id'], $styleIds)) { 673 if (in_array($v['style_id'], $styleIds)) {
671 if (!$styleNum) { 674 if (!$styleNum) {
@@ -684,6 +687,7 @@ class HelperSearch @@ -684,6 +687,7 @@ class HelperSearch
684 $url = self::buildUrl(array_merge($params, array( 687 $url = self::buildUrl(array_merge($params, array(
685 'style' => implode(',', $selectedStyle) 688 'style' => implode(',', $selectedStyle)
686 ))); 689 )));
  690 + $checked = true;
687 } 691 }
688 //该风格url参数中添加该风格的id 692 //该风格url参数中添加该风格的id
689 else { 693 else {
@@ -696,6 +700,7 @@ class HelperSearch @@ -696,6 +700,7 @@ class HelperSearch
696 'id' => $v['style_id'], 700 'id' => $v['style_id'],
697 'name' => $v['style_name'], 701 'name' => $v['style_name'],
698 'href' => $url, 702 'href' => $url,
  703 + 'checked' => $checked
699 ); 704 );
700 } 705 }
701 if (isset(self::$params['style']) && !empty(self::$params['style'])) { 706 if (isset(self::$params['style']) && !empty(self::$params['style'])) {
@@ -1284,16 +1289,41 @@ class HelperSearch @@ -1284,16 +1289,41 @@ class HelperSearch
1284 */ 1289 */
1285 public static function fromPram($url, $position, $abEnabled = false) 1290 public static function fromPram($url, $position, $abEnabled = false)
1286 { 1291 {
  1292 + $type = '';
1287 $itemFrom = ChannelConfig::$itemFromStats; 1293 $itemFrom = ChannelConfig::$itemFromStats;
  1294 +
1288 $controller = isset(self::$options['controller']) ? strtolower(self::$options['controller']) : ''; 1295 $controller = isset(self::$options['controller']) ? strtolower(self::$options['controller']) : '';
1289 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : ''; 1296 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : '';
  1297 + //列表页面
  1298 + if ($controller == 'list' && $action == 'index') {
  1299 + $type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : '';
  1300 + }
  1301 + //新品到着
  1302 + elseif ($controller == 'list' && $action == 'new') {
  1303 + if (isset(self::$params['shelve_time'])) {
  1304 + $date = explode(',', self::$params['shelve_time']);
  1305 + $date = date('Y-m-d', $date[0]);
  1306 + }
  1307 + $type = $date;
  1308 + }
  1309 + //list - sale
  1310 + elseif ($controller == 'list' && $action == 'sale') {
  1311 + $type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
  1312 + }
  1313 + // 品牌
  1314 + elseif ($controller == 'list' && $action == 'sale') {
  1315 + $type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
  1316 + }
  1317 + // 搜索
  1318 + elseif ($controller == 'search') {
  1319 + $type = isset(self::$params['query']) && self::$params['query'] ? self::$params['query'] : '';
  1320 + }
1290 $itemIndex = $controller."_".$action; 1321 $itemIndex = $controller."_".$action;
1291 //获取domain-module-$keyword_page_position{ab} 1322 //获取domain-module-$keyword_page_position{ab}
1292 $ab = (isset($_COOKIE['ab_5']) && $abEnabled == true) ? '_'.$_COOKIE['ab_5'] : ''; 1323 $ab = (isset($_COOKIE['ab_5']) && $abEnabled == true) ? '_'.$_COOKIE['ab_5'] : '';
1293 $page = self::$page; 1324 $page = self::$page;
1294 - $keyword = isset(self::$options['query']) ? self::$options['query'] : '';  
1295 if (isset($itemFrom[$itemIndex])) { 1325 if (isset($itemFrom[$itemIndex])) {
1296 - $url .= "?from={$itemFrom[$itemIndex]['domain']}-{$itemFrom[$itemIndex]['module']}-{$keyword}_{$page}_{$position}{$ab}"; 1326 + $url .= "?from={$itemFrom[$itemIndex]['domain']}-{$itemFrom[$itemIndex]['module']}-{$type}_{$page}_{$position}{$ab}";
1297 } 1327 }
1298 return $url; 1328 return $url;
1299 } 1329 }
@@ -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 }