|
|
@@ -15,9 +15,9 @@ use App\Helpers\Jwt;
|
|
|
use App\Models\ActionLogModel;
|
|
|
use App\Models\UserModel;
|
|
|
use App\Services\BaseService;
|
|
|
+use App\Services\RedisService;
|
|
|
use Carbon\Carbon;
|
|
|
use Earnp\GoogleAuthenticator\GoogleAuthenticator;
|
|
|
-use Illuminate\Support\Facades\Session;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
use Gregwar\Captcha\CaptchaBuilder;
|
|
|
use Gregwar\Captcha\PhraseBuilder;
|
|
|
@@ -146,7 +146,7 @@ class LoginService extends BaseService
|
|
|
|
|
|
// 谷歌验证码验证
|
|
|
$googleBind = isset($info['google_bind'])? intval($info['google_bind']) : 0;
|
|
|
- $googleKey = isset($info['google_key'])? trim($info['google_bind']) : '';
|
|
|
+ $googleKey = isset($info['google_key'])? trim($info['google_key']) : '';
|
|
|
$googleCode = isset($param['google_code'])? trim($param['google_code']) : '';
|
|
|
if($googleBind == 1 && $googleKey){
|
|
|
if(empty($googleCode)){
|
|
|
@@ -190,4 +190,29 @@ class LoginService extends BaseService
|
|
|
return message();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 验证账号
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function checkAccount()
|
|
|
+ {
|
|
|
+ // 获取参数
|
|
|
+ $param = request()->all();
|
|
|
+ $username = isset($param['username'])? trim($param['username']) : '';
|
|
|
+ if(empty($username)){
|
|
|
+ return message('请填写登录账号', false);
|
|
|
+ }
|
|
|
+
|
|
|
+ $cacheKey = "caches:user:checkAccount_".md5($username);
|
|
|
+ if($data = RedisService::get($cacheKey)){
|
|
|
+ return message(1010, true, $data);
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = UserModel::where(['username'=>$username])->value('google_bind');
|
|
|
+ if($data){
|
|
|
+ RedisService::set($cacheKey, $data, rand(5, 10));
|
|
|
+ }
|
|
|
+ return message(1010, true, $data);
|
|
|
+ }
|
|
|
+
|
|
|
}
|