Authored by hf

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

@@ -12,8 +12,10 @@ @@ -12,8 +12,10 @@
12 </li> 12 </li>
13 {{#each list}} 13 {{#each list}}
14 <li {{#if active}}class="active"{{/if}}> 14 <li {{#if active}}class="active"{{/if}}>
15 - <a href="{{href}}">{{name}}</a> 15 + <a href="{{href}}">
  16 + {{name}}
16 <span>{{num}}</span> 17 <span>{{num}}</span>
  18 + </a>
17 </li> 19 </li>
18 {{/each}} 20 {{/each}}
19 </ul> 21 </ul>
@@ -30,8 +32,10 @@ @@ -30,8 +32,10 @@
30 <ul class="sort-child-list new-sale"> 32 <ul class="sort-child-list new-sale">
31 {{#each list}} 33 {{#each list}}
32 <li {{#if active}}active{{/if}}> 34 <li {{#if active}}active{{/if}}>
33 - <a href="{{href}}">{{name}}</a> 35 + <a href="{{href}}">
  36 + {{name}}
34 <span>{{num}}</span> 37 <span>{{num}}</span>
  38 + </a>
35 </li> 39 </li>
36 {{/each}} 40 {{/each}}
37 </ul> 41 </ul>
@@ -51,7 +51,8 @@ @@ -51,7 +51,8 @@
51 } 51 }
52 52
53 /*990px*/ 53 /*990px*/
54 -.min-screen .product-list-page, .new-sale-page { 54 +.min-screen .product-list-page,
  55 +.min-screen .new-sale-page {
55 56
56 .list-right { 57 .list-right {
57 width: 810px; 58 width: 810px;
@@ -7,6 +7,7 @@ use LibModels\Web\Home\IndexData; @@ -7,6 +7,7 @@ use LibModels\Web\Home\IndexData;
7 use LibModels\Web\Home\UserData; 7 use LibModels\Web\Home\UserData;
8 use WebPlugin\Images; 8 use WebPlugin\Images;
9 use WebPlugin\Captcha; 9 use WebPlugin\Captcha;
  10 +use WebPlugin\Cache;
10 11
11 /** 12 /**
12 * web登录注册等相关数据构建 13 * web登录注册等相关数据构建
@@ -134,4 +135,22 @@ class PassportModel @@ -134,4 +135,22 @@ class PassportModel
134 return $ret; 135 return $ret;
135 } 136 }
136 137
  138 + /*
  139 + * 重写递增计数 cache方法
  140 + * $key cache-key
  141 + * $offset 递增偏移量
  142 + * $initValue 初始化值
  143 + * $expiry 缓存时间
  144 + */
  145 + public static function increment($key, $offset = 1, $initValue = 0, $expire = 1800)
  146 + {
  147 + //初始化key
  148 + if (!Cache::get($key)) {
  149 + Cache::set($key, $initValue, $expire);
  150 + }
  151 + //增加偏移量
  152 + $cacheValue = intval(Cache::get($key))+$offset;
  153 + Cache::set($key, $cacheValue, $expire);
  154 + }
  155 +
137 } 156 }
@@ -135,12 +135,14 @@ class BrandsModel @@ -135,12 +135,14 @@ class BrandsModel
135 135
136 //获取$condition和$option 筛选条件和排序条件 136 //获取$condition和$option 筛选条件和排序条件
137 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions); 137 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
138 -  
139 // 组合搜索商品url 138 // 组合搜索商品url
140 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']); 139 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
141 140
142 // 组合搜索分类url 141 // 组合搜索分类url
143 - $urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']); 142 + $brandSort = array(
  143 + 'brand' => $searchCondition['sortCondition']['brand']
  144 + );
  145 + $urlList['sort'] = SearchData::getClassesUrl($brandSort);
144 146
145 //组合搜索品牌url 147 //组合搜索品牌url
146 $urlList['brand'] = SearchData::getBrandUrl($customOptions); 148 $urlList['brand'] = SearchData::getBrandUrl($customOptions);
@@ -109,26 +109,21 @@ class LoginController extends WebAction @@ -109,26 +109,21 @@ class LoginController extends WebAction
109 $ip = Helpers::getClientIp(); 109 $ip = Helpers::getClientIp();
110 $ipKey = md5('ip_signin_' . $ip); 110 $ipKey = md5('ip_signin_' . $ip);
111 $accountKey = md5('account_signin_' . $account); 111 $accountKey = md5('account_signin_' . $account);
112 - if (!Cache::get($ipKey)) {  
113 - Cache::set($ipKey, 0);  
114 - }  
115 - if (!Cache::get($accountKey)) {  
116 - Cache::set($accountKey, 0);  
117 - }  
118 - Cache::increment($ipKey, 1, 0, 3600); 112 + PassportModel::increment($ipKey, 1, 0, 3600);
119 $accountTimes = Cache::get($accountKey); 113 $accountTimes = Cache::get($accountKey);
120 - $ipTimes = Cache::get($ipKey);  
121 if ($accountTimes > 10) { 114 if ($accountTimes > 10) {
122 $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => ''); 115 $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
123 break; 116 break;
124 } 117 }
  118 +
  119 + $ipTimes = Cache::get($ipKey);
125 if ($ipTimes > 100) { 120 if ($ipTimes > 100) {
126 $data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => ''); 121 $data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => '');
127 break; 122 break;
128 } 123 }
129 $data = LoginData::signin($area, $account, $password, $shoppingKey); 124 $data = LoginData::signin($area, $account, $password, $shoppingKey);
130 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { 125 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
131 - Cache::increment($accountKey, 1, 0, 1800); 126 + PassportModel::increment($accountKey, 1, 0, 1800);
132 $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => ''); 127 $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
133 break; 128 break;
134 } 129 }
@@ -48,10 +48,8 @@ class RegisterController extends WebAction @@ -48,10 +48,8 @@ class RegisterController extends WebAction
48 $ip = Helpers::getClientIp(); 48 $ip = Helpers::getClientIp();
49 $data = array('code' => 400, 'message' => '', 'data' => ''); 49 $data = array('code' => 400, 'message' => '', 'data' => '');
50 $ipKey = md5('ip_checkmobile_' . $ip); 50 $ipKey = md5('ip_checkmobile_' . $ip);
51 - if (!Cache::get($ipKey)) {  
52 - Cache::set($ipKey, 0);  
53 - }  
54 - $ipTimes = Cache::increment($ipKey, 1, 0, 3600); 51 + PassportModel::increment($ipKey, 1, 0, 3600);
  52 + $ipTimes = Cache::get($ipKey);
55 do{ 53 do{
56 /* 判断是不是AJAX请求 */ 54 /* 判断是不是AJAX请求 */
57 if (!$this->isAjax()) { 55 if (!$this->isAjax()) {
@@ -132,10 +130,8 @@ class RegisterController extends WebAction @@ -132,10 +130,8 @@ class RegisterController extends WebAction
132 } 130 }
133 //发送代码 131 //发送代码
134 $sendCodeKey = md5('send_code_' . $area . '_' . $mobile); 132 $sendCodeKey = md5('send_code_' . $area . '_' . $mobile);
135 - if (!Cache::get($sendCodeKey)) {  
136 - Cache::set($sendCodeKey, 0);  
137 - }  
138 - $sendCodeTimes = Cache::increment($sendCodeKey, 1, 0, 3600); 133 + PassportModel::increment($sendCodeKey, 1, 0, 3600);
  134 + $sendCodeTimes = Cache::get($sendCodeKey);
139 if ($sendCodeTimes > 50) { 135 if ($sendCodeTimes > 50) {
140 $data['message'] = '发送验证码太多'; 136 $data['message'] = '发送验证码太多';
141 break; 137 break;
@@ -25,6 +25,7 @@ class ThirdloginController extends WebAction @@ -25,6 +25,7 @@ class ThirdloginController extends WebAction
25 'openId' => $openId, 25 'openId' => $openId,
26 'sourceType' => $sourceType, 26 'sourceType' => $sourceType,
27 'region' => RegData::getAreasData(), 27 'region' => RegData::getAreasData(),
  28 + 'serviceUrl' => Helpers::url('/help', array('category_id' => 9))
28 ); 29 );
29 30
30 $this->_view->display('index', $data); 31 $this->_view->display('index', $data);
@@ -57,6 +58,7 @@ class ThirdloginController extends WebAction @@ -57,6 +58,7 @@ class ThirdloginController extends WebAction
57 * 绑定成功 58 * 绑定成功
58 * 59 *
59 */ 60 */
  61 +
60 public function bindSuccessAction() 62 public function bindSuccessAction()
61 { 63 {
62 64