From db2682054493808ff57adf8fd8bf078de907066d Mon Sep 17 00:00:00 2001 From: lkddi Date: Fri, 3 Apr 2026 14:05:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E7=BE=A4=E5=86=85=E7=AE=A1=E7=90=86=E5=91=98=E4=B8=8A=E7=BA=BF?= =?UTF-8?q?=E6=92=AD=E6=8A=A5=E4=BB=85=E9=92=88=E5=AF=B9=E6=8B=A5=E6=9C=89?= =?UTF-8?q?=E8=81=8C=E5=8A=A1=E7=9A=84=E7=94=A8=E6=88=B7=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=89=8D=E7=BD=AE=E6=98=BE=E7=A4=BA=E9=83=A8=E9=97=A8=E5=8F=8A?= =?UTF-8?q?=E8=81=8C=E5=8A=A1=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/WechatBot/WechatNotificationService.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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); }