账号密码登录

This commit is contained in:
2025-10-13 10:42:11 +08:00
parent cb05d174c0
commit 8891e14154

View File

@@ -295,17 +295,35 @@ class Login extends Model
}
if (md5($password) != $user_info['password']) {
$data = [
'mobile' => $user_name,
'type' => 2,
'sms' => $password,
'createtime'=> time(),
];
db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '密码错误', 'data' => null];
}
// $multi_user = [];
// //查询手机号绑定的账号
// $phone_user = $this->phone_login_query($user_name);
// if($phone_user['code'] == 1){
// //获取返回数据的长度
// if(count($phone_user['data']) >= 2){
// $multi_user = $phone_user['data'];
// }
// }
//今天误次数
$sms_count = db::name('sms_error')->where(['mobile' => $user_name,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
if ($sms_count >= 5) {
$user_id = db::name('user')->where('mobile', $user_name)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){
//封禁账号
$error_data = [
'type' => 1,
'type_text' => $user_id,
'block_time' => time() + 60 * 60 * 24,
'block_note' => '账号登录异常被封禁24小时',
'createtime'=> time(),
];
db::name('block')->insert($error_data);
}
return ['code' => 0, 'msg' => '登录错误次数过多,账号已被封禁,请联系管理员处理','data' =>null];
}
$login = $this->login($user_info,$system,$login_device);
if($login['code'] != 1){