统一风格都用$user->id

pull/506/head
ken678 2025-08-06 10:19:08 +08:00
parent f804c8a460
commit e06f0e2738
1 changed files with 2 additions and 2 deletions

View File

@ -179,14 +179,14 @@ class User extends Api
$bio = $this->request->post('bio');
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
if ($username) {
$exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find();
$exists = \app\common\model\User::where('username', $username)->where('id', '<>', $user->id)->find();
if ($exists) {
$this->error(__('Username already exists'));
}
$user->username = $username;
}
if ($nickname) {
$exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
$exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $user->id)->find();
if ($exists) {
$this->error(__('Nickname already exists'));
}