feat: 引入 MyBusinessException 类,修改错误处理方式

This commit is contained in:
mkm 2024-05-28 18:44:35 +08:00
parent f69d4418b0
commit 14ab4d734a

View File

@ -9,6 +9,7 @@ use app\common\enum\AdminTerminalEnum;
use app\common\model\auth\Admin;
use app\common\service\ConfigService;
use app\common\validate\BaseValidate;
use app\MyBusinessException;
use Webman\Config;
class LoginValidate extends BaseValidate
@ -53,7 +54,7 @@ class LoginValidate extends BaseValidate
//后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
if ($config['login_restrictions'] == 1 && !$adminAccountSafeCache->isSafe()) {
return '密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试';
new MyBusinessException('密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试');
}
$adminInfo = Admin::where('account', '=', $data['account'])