diff --git a/app/Services/WechatBot/WechatNotificationService.php b/app/Services/WechatBot/WechatNotificationService.php index 644708a..b7a9d67 100644 --- a/app/Services/WechatBot/WechatNotificationService.php +++ b/app/Services/WechatBot/WechatNotificationService.php @@ -70,14 +70,18 @@ class WechatNotificationService return; } - // 判断是否真的是管理员(这里假设大于等于某等级,比如 15) - $adminLevel = (int) Sysparam::getValue('level_kick', '15'); - if ($user->user_level < $adminLevel) { + // 只播报有职务的管理员 + $activePosition = $user->activePosition; + if (! $activePosition) { return; } + $departmentName = $activePosition->position->department->name ?? ''; + $positionName = $activePosition->position->name ?? ''; + $title = trim("{$departmentName}{$positionName}") ?: '技术员'; + $message = "👑 【管理员上线】\n" - ."管理员 [{$user->username}] 刚刚登录了系统。"; + ."{$title} [{$user->username}] 刚刚登录了系统。"; SendWechatBotMessage::dispatch($groupWxid, $message); }