!506 统一风格都用$user->id

Merge pull request !506 from 御宅男(YznCMS官方)/Branch_f804c8a5
pull/507/MERGE
Karson 2025-08-06 02:56:24 +00:00 committed by Gitee
commit 1a3739f41c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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'));
}