Authored by hf

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

... ... @@ -12,8 +12,10 @@
</li>
{{#each list}}
<li {{#if active}}class="active"{{/if}}>
<a href="{{href}}">{{name}}</a>
<span>{{num}}</span>
<a href="{{href}}">
{{name}}
<span>{{num}}</span>
</a>
</li>
{{/each}}
</ul>
... ... @@ -30,8 +32,10 @@
<ul class="sort-child-list new-sale">
{{#each list}}
<li {{#if active}}active{{/if}}>
<a href="{{href}}">{{name}}</a>
<span>{{num}}</span>
<a href="{{href}}">
{{name}}
<span>{{num}}</span>
</a>
</li>
{{/each}}
</ul>
... ...
... ... @@ -51,7 +51,8 @@
}
/*990px*/
.min-screen .product-list-page, .new-sale-page {
.min-screen .product-list-page,
.min-screen .new-sale-page {
.list-right {
width: 810px;
... ...
... ... @@ -7,6 +7,7 @@ use LibModels\Web\Home\IndexData;
use LibModels\Web\Home\UserData;
use WebPlugin\Images;
use WebPlugin\Captcha;
use WebPlugin\Cache;
/**
* web登录注册等相关数据构建
... ... @@ -134,4 +135,22 @@ class PassportModel
return $ret;
}
/*
* 重写递增计数 cache方法
* $key cache-key
* $offset 递增偏移量
* $initValue 初始化值
* $expiry 缓存时间
*/
public static function increment($key, $offset = 1, $initValue = 0, $expire = 1800)
{
//初始化key
if (!Cache::get($key)) {
Cache::set($key, $initValue, $expire);
}
//增加偏移量
$cacheValue = intval(Cache::get($key))+$offset;
Cache::set($key, $cacheValue, $expire);
}
}
... ...
... ... @@ -135,12 +135,14 @@ class BrandsModel
//获取$condition和$option 筛选条件和排序条件
$searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
$brandSort = array(
'brand' => $searchCondition['sortCondition']['brand']
);
$urlList['sort'] = SearchData::getClassesUrl($brandSort);
//组合搜索品牌url
$urlList['brand'] = SearchData::getBrandUrl($customOptions);
... ...
... ... @@ -109,27 +109,22 @@ class LoginController extends WebAction
$ip = Helpers::getClientIp();
$ipKey = md5('ip_signin_' . $ip);
$accountKey = md5('account_signin_' . $account);
if (!Cache::get($ipKey)) {
Cache::set($ipKey, 0);
}
if (!Cache::get($accountKey)) {
Cache::set($accountKey, 0);
}
Cache::increment($ipKey, 1, 0, 3600);
PassportModel::increment($ipKey, 1, 0, 3600);
$accountTimes = Cache::get($accountKey);
$ipTimes = Cache::get($ipKey);
if ($accountTimes > 10) {
$data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
break;
}
$ipTimes = Cache::get($ipKey);
if ($ipTimes > 100) {
$data = array('code' => 400, 'message' => '您尝试的次数过多,账号已被暂时锁定,请稍后再试', 'data' => '');
break;
}
$data = LoginData::signin($area, $account, $password, $shoppingKey);
if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
Cache::increment($accountKey, 1, 0, 1800);
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
PassportModel::increment($accountKey, 1, 0, 1800);
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
break;
}
... ...
... ... @@ -48,10 +48,8 @@ class RegisterController extends WebAction
$ip = Helpers::getClientIp();
$data = array('code' => 400, 'message' => '', 'data' => '');
$ipKey = md5('ip_checkmobile_' . $ip);
if (!Cache::get($ipKey)) {
Cache::set($ipKey, 0);
}
$ipTimes = Cache::increment($ipKey, 1, 0, 3600);
PassportModel::increment($ipKey, 1, 0, 3600);
$ipTimes = Cache::get($ipKey);
do{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
... ... @@ -132,10 +130,8 @@ class RegisterController extends WebAction
}
//发送代码
$sendCodeKey = md5('send_code_' . $area . '_' . $mobile);
if (!Cache::get($sendCodeKey)) {
Cache::set($sendCodeKey, 0);
}
$sendCodeTimes = Cache::increment($sendCodeKey, 1, 0, 3600);
PassportModel::increment($sendCodeKey, 1, 0, 3600);
$sendCodeTimes = Cache::get($sendCodeKey);
if ($sendCodeTimes > 50) {
$data['message'] = '发送验证码太多';
break;
... ...
... ... @@ -25,6 +25,7 @@ class ThirdloginController extends WebAction
'openId' => $openId,
'sourceType' => $sourceType,
'region' => RegData::getAreasData(),
'serviceUrl' => Helpers::url('/help', array('category_id' => 9))
);
$this->_view->display('index', $data);
... ... @@ -57,6 +58,7 @@ class ThirdloginController extends WebAction
* 绑定成功
*
*/
public function bindSuccessAction()
{
... ...