From 05ec4a72b71de7bcb3217486438210bb9dcae7df Mon Sep 17 00:00:00 2001 From: pllx Date: Tue, 28 Apr 2026 14:14:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=AC=E5=B1=8F=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=BC=B9=E5=8F=B3=E4=B8=8B=E8=A7=92=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=EF=BC=88=E6=89=80=E6=9C=89=E4=BA=BA=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AdminCommandController.php | 7 +++++++ resources/js/chat-room/chat-events.js | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/AdminCommandController.php b/app/Http/Controllers/AdminCommandController.php index 62a6639..e85f8dc 100644 --- a/app/Http/Controllers/AdminCommandController.php +++ b/app/Http/Controllers/AdminCommandController.php @@ -524,6 +524,13 @@ class AdminCommandController extends Controller 'font_color' => '#b91c1c', 'action' => '', 'sent_at' => now()->toDateTimeString(), + 'toast_notification' => [ + 'title' => '📢 公屏公告', + 'message' => strip_tags($content), + 'icon' => '📢', + 'color' => '#b91c1c', + 'duration' => 10000, + ], ]; $this->chatState->pushMessage($roomId, $msg); broadcast(new MessageSent($roomId, $msg)); diff --git a/resources/js/chat-room/chat-events.js b/resources/js/chat-room/chat-events.js index 6ce077a..73644df 100644 --- a/resources/js/chat-room/chat-events.js +++ b/resources/js/chat-room/chat-events.js @@ -370,8 +370,8 @@ export function bindChatEvents() { window.showVipPresenceBanner(msg); } - // 若消息携带 toast_notification 字段且当前用户是接收者,弹右下角小卡片 - if (msg.toast_notification && msg.to_user === window.chatContext?.username) { + // 若消息携带 toast_notification 字段且当前用户是接收者或为公屏广播,弹右下角小卡片 + if (msg.toast_notification && (msg.to_user === window.chatContext?.username || msg.to_user === '大家')) { const t = msg.toast_notification; window.chatToast?.show({ title: t.title || "通知",