From 948185042d93818f7c084877e93673b6fdc7b3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sun, 6 Apr 2025 09:10:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E7=94=A8=E6=88=B7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/service/contract/AccountAccess.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/think-plugs-account/src/service/contract/AccountAccess.php b/plugin/think-plugs-account/src/service/contract/AccountAccess.php index 8f09b59ee..68729233e 100644 --- a/plugin/think-plugs-account/src/service/contract/AccountAccess.php +++ b/plugin/think-plugs-account/src/service/contract/AccountAccess.php @@ -161,6 +161,8 @@ class AccountAccess implements AccountInterface } $this->bind = $this->save(array_merge($data, ['type' => $this->type])); if ($this->bind->isEmpty()) throw new Exception('更新资料失败!'); + // 刷新更新用户模型 + $this->user = $this->bind->user()->findOrEmpty(); return $this->token()->get($rejwt); } @@ -178,6 +180,9 @@ class AccountAccess implements AccountInterface } $data = $this->bind->hidden(['sort', 'password'], true)->toArray(); if ($this->bind->isExists()) { + if ($this->user->isEmpty()) { + $this->user = $this->bind->user()->findOrEmpty(); + } $data['user'] = $this->user->hidden(['sort', 'password'], true)->toArray(); if ($rejwt) $data['token'] = $this->isjwt ? JwtExtend::token([ 'type' => $this->auth->getAttr('type'), 'token' => $this->auth->getAttr('token') @@ -419,6 +424,7 @@ class AccountAccess implements AccountInterface * @param boolean $expire * @return AccountInterface * @throws \think\admin\Exception + * @throws \think\db\exception\DbException */ public function token(bool $expire = true): AccountInterface {