修复礼包领取弹窗重复显示

This commit is contained in:
pllx
2026-05-05 21:48:51 +08:00
parent 11a882bd8e
commit 725a38eac3
3 changed files with 39 additions and 7 deletions
+19 -7
View File
@@ -94,6 +94,8 @@ class GameBetBroadcastService
toastMessage: "<b>{$username}</b> 抢到 <b>{$formattedAmount}</b> {$typeLabel}礼包",
toastIcon: '🧧',
toastColor: $toastColor,
toastActorUsername: $username,
skipToastForActor: true,
);
}
@@ -109,7 +111,23 @@ class GameBetBroadcastService
string $toastIcon,
string $toastColor,
string $action = '',
?string $toastActorUsername = null,
bool $skipToastForActor = false,
): void {
$toastNotification = [
'title' => $toastTitle,
'message' => $toastMessage,
'icon' => $toastIcon,
'color' => $toastColor,
'duration' => 8000,
];
if ($toastActorUsername !== null) {
// 记录触发人用于前端去重,避免本人同时看到本地到账提示和公屏领取提示。
$toastNotification['actor_username'] = $toastActorUsername;
$toastNotification['skip_for_actor'] = $skipToastForActor;
}
$message = [
'id' => $this->chatState->nextMessageId($roomId),
'room_id' => $roomId,
@@ -120,13 +138,7 @@ class GameBetBroadcastService
'font_color' => $fontColor,
'action' => $action,
'sent_at' => now()->toDateTimeString(),
'toast_notification' => [
'title' => $toastTitle,
'message' => $toastMessage,
'icon' => $toastIcon,
'color' => $toastColor,
'duration' => 8000,
],
'toast_notification' => $toastNotification,
];
// 下注通知必须进房间 Presence 频道,确保当前房间所有在线人员都能看到右下角提示。