fix(observer): 修复 UserObserver 调用 private 方法 authInfo() 的错误

将 User::authInfo() 改为 User::userid(),因为 authInfo() 是 private 方法,
Observer 无法访问。userid() 是 public 方法,内部会正确调用 authInfo()。

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
kuaifan 2026-01-21 16:58:11 +00:00
parent f68f759418
commit 2cdde37069

View File

@ -99,8 +99,8 @@ class UserObserver extends AbstractObserver
if (!empty($changedFields)) {
// 判断是用户自己修改还是管理员修改
$currentUser = User::authInfo();
$eventType = ($currentUser && $currentUser->userid === $user->userid)
$currentUserid = User::userid();
$eventType = ($currentUserid > 0 && $currentUserid === $user->userid)
? 'profile_update'
: 'admin_update';
Apps::dispatchUserHook($user, 'user_update', $eventType, $changedFields);