Commit b18651ba authored by jianghaiming's avatar jianghaiming

Merge branch 'jiang_fix_20210906' into test

parents 22165a5c 6eb88cf3
...@@ -33,12 +33,17 @@ class UserService ...@@ -33,12 +33,17 @@ class UserService
throw new UserException(['cus' => 0]); throw new UserException(['cus' => 0]);
} }
//频率锁 $redis = RedisUtil::getInstance('cache');
$key = "wx_wechat_login".$params['code']; $key = "wx_wechat_login_".$code;
$keyCode = "wx_wechat_login_code_".$code;
$lock = FrequencyLockUtil::isLocked($key); $lock = FrequencyLockUtil::isLocked($key);
if ($lock) { if ($lock) {
FileLog::error("wechatLogin:请求频繁", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com'); sleep(1);
throw new UserException(['cus' => 13]); $user = $redis->get($keyCode);
if (!empty($user)) {
$user = json_decode($user,true);
}
return $user;
} }
//需要授权微信 //需要授权微信
...@@ -109,7 +114,9 @@ class UserService ...@@ -109,7 +114,9 @@ class UserService
$newWechatId = UserWechatBind::save($insert,['openid' => $openid]); $newWechatId = UserWechatBind::save($insert,['openid' => $openid]);
} }
$user['third_session'] = self::generate3rdSession($openid); $user['third_session'] = self::generate3rdSession($openid);
$redis->set($keyCode, json_encode($user),10);
return $user; return $user;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment