diff --git a/application/api/model/Login.php b/application/api/model/Login.php index 4710ff0..e842659 100644 --- a/application/api/model/Login.php +++ b/application/api/model/Login.php @@ -293,7 +293,9 @@ class Login extends Model if (empty($user_info)) { 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']) { $data = [ 'mobile' => $user_name, @@ -302,12 +304,10 @@ class Login extends Model 'createtime'=> time(), ]; db::name('sms_error')->insert($data); - return ['code' => 0, 'msg' => '密码错误', 'data' => null]; + return ['code' => 0, 'msg' => '密码错误,'.$count_sms.'次后账号将被封禁24小时', 'data' => null]; } - //今天误次数 - $sms_count = db::name('sms_error')->where(['mobile' => $user_name,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count(); - if ($sms_count >= 5) { + 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){