账号密码登录

This commit is contained in:
2025-10-13 10:47:15 +08:00
parent 8891e14154
commit 1cb3a00718

View File

@@ -293,7 +293,9 @@ class Login extends Model
if (empty($user_info)) { if (empty($user_info)) {
return ['code' => 0, 'msg' => '用户不存在', 'data' => null]; return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
} }
//今天误次数
$sms_count = db::name('sms_error')->where(['mobile' => $user_name,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
$count_sms = max(5 - $sms_count, 0);
if (md5($password) != $user_info['password']) { if (md5($password) != $user_info['password']) {
$data = [ $data = [
'mobile' => $user_name, 'mobile' => $user_name,
@@ -302,12 +304,10 @@ class Login extends Model
'createtime'=> time(), 'createtime'=> time(),
]; ];
db::name('sms_error')->insert($data); db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '密码错误', 'data' => null]; return ['code' => 0, 'msg' => '密码错误'.$count_sms.'次后账号将被封禁24小时', 'data' => null];
} }
//今天误次数 if ($sms_count >= 5) {
$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'); $user_id = db::name('user')->where('mobile', $user_name)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find(); $block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){ if(!$block_num){