更新细节

This commit is contained in:
yaooo 2023-11-20 14:46:36 +08:00
parent ea93a4d57b
commit 2e9f0d17dd
2 changed files with 6 additions and 1 deletions

View File

@ -93,7 +93,11 @@ class LoginLogic extends BaseLogic
{ {
try { try {
$where = ['phone' => $params['account']]; $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_time = time();
$user->last_login_ip = request()->ip(); $user->last_login_ip = request()->ip();

View File

@ -31,6 +31,7 @@ class UserLogic extends BaseLogic
$password = create_password($params['password'], $passwordSalt); $password = create_password($params['password'], $passwordSalt);
// 更新 // 更新
$user->password = $password; $user->password = $password;
$user->need_reset = 0;
$user->save(); $user->save();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {