feat: 公屏公告同时弹右下角通知(所有人可见)
This commit is contained in:
@@ -524,6 +524,13 @@ class AdminCommandController extends Controller
|
|||||||
'font_color' => '#b91c1c',
|
'font_color' => '#b91c1c',
|
||||||
'action' => '',
|
'action' => '',
|
||||||
'sent_at' => now()->toDateTimeString(),
|
'sent_at' => now()->toDateTimeString(),
|
||||||
|
'toast_notification' => [
|
||||||
|
'title' => '📢 公屏公告',
|
||||||
|
'message' => strip_tags($content),
|
||||||
|
'icon' => '📢',
|
||||||
|
'color' => '#b91c1c',
|
||||||
|
'duration' => 10000,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
$this->chatState->pushMessage($roomId, $msg);
|
$this->chatState->pushMessage($roomId, $msg);
|
||||||
broadcast(new MessageSent($roomId, $msg));
|
broadcast(new MessageSent($roomId, $msg));
|
||||||
|
|||||||
@@ -370,8 +370,8 @@ export function bindChatEvents() {
|
|||||||
window.showVipPresenceBanner(msg);
|
window.showVipPresenceBanner(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 若消息携带 toast_notification 字段且当前用户是接收者,弹右下角小卡片
|
// 若消息携带 toast_notification 字段且当前用户是接收者或为公屏广播,弹右下角小卡片
|
||||||
if (msg.toast_notification && msg.to_user === window.chatContext?.username) {
|
if (msg.toast_notification && (msg.to_user === window.chatContext?.username || msg.to_user === '大家')) {
|
||||||
const t = msg.toast_notification;
|
const t = msg.toast_notification;
|
||||||
window.chatToast?.show({
|
window.chatToast?.show({
|
||||||
title: t.title || "通知",
|
title: t.title || "通知",
|
||||||
|
|||||||
Reference in New Issue
Block a user