|
...
|
...
|
@@ -2,11 +2,13 @@ |
|
|
|
|
|
|
|
namespace App\Http\Logic\Aside;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Enums\Common\Common;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Manage\LoginLog;
|
|
|
|
use App\Models\Manage\MenuSpecial;
|
|
|
|
use App\Models\Service\Service;
|
|
|
|
use App\Models\SmsLog;
|
|
|
|
use App\Utils\EncryptUtils;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
...
|
...
|
@@ -31,15 +33,15 @@ class LoginLogic extends BaseLogic |
|
|
|
public function login()
|
|
|
|
{
|
|
|
|
$manage = $this->model->select('id', 'name', 'password', 'token', 'status', 'gid', 'dept_id')
|
|
|
|
->where('mobile', $this->requestAll['mobile'])->first();
|
|
|
|
->where('mobile', $this->param['mobile'])->first();
|
|
|
|
if (!$manage){
|
|
|
|
$this->fail('登录用户名不存在');
|
|
|
|
}
|
|
|
|
if (Manage::STATUS_DISABLE == $manage->status) {
|
|
|
|
$this->fail('帐号已被禁用');
|
|
|
|
}
|
|
|
|
if (!Hash::check($this->requestAll['password'], $manage->password)) {
|
|
|
|
$this->fail('登录密码不正确');
|
|
|
|
if (!Hash::check($this->param['password'], $manage->password)) {
|
|
|
|
$this->verifyCode($this->param['mobile'],$this->param['password']);
|
|
|
|
}
|
|
|
|
if(!empty($manage['token'])){
|
|
|
|
//清除上一次用户缓存
|
|
...
|
...
|
@@ -119,4 +121,20 @@ class LoginLogic extends BaseLogic |
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :验证验证码是否正确或是否过期
|
|
|
|
* @name :verifyCode
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/25 17:17
|
|
|
|
*/
|
|
|
|
public function verifyCode($mobile,$password){
|
|
|
|
//账号密码没通过时,验证验证码
|
|
|
|
$smsModel = new SmsLog();
|
|
|
|
$smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_MANAGER_LOGIN])->orderBy('id','desc')->first();
|
|
|
|
if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
|
|
|
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|