From 2e9f0d17ddf52d7c842e0ad6b537cf66ae919fa3 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 20 Nov 2023 14:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LoginLogic.php | 6 +++++- app/api/logic/UserLogic.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index fc7d5480..05048433 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -93,7 +93,11 @@ class LoginLogic extends BaseLogic { try { $where = ['phone' => $params['account']]; - $user = User::field(['id', 'phone', 'avatar', 'nickname'])->where($where)->findOrEmpty(); + $user = User::field(['id', 'phone', 'avatar', 'nickname', 'need_reset'])->where($where)->findOrEmpty(); + if ($user->need_reset == 1) { + self::setError('系统已升级,请重置密码'); + return false; + } //更新登录信息 $user->last_login_time = time(); $user->last_login_ip = request()->ip(); diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 4be1707b..5cbd74dc 100644 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -31,6 +31,7 @@ class UserLogic extends BaseLogic $password = create_password($params['password'], $passwordSalt); // 更新 $user->password = $password; + $user->need_reset = 0; $user->save(); return true; } catch (\Exception $e) {