赠金币 增加右下角弹窗

This commit is contained in:
2026-04-14 21:59:49 +08:00
parent df29da7440
commit 392f46769c
2 changed files with 11 additions and 0 deletions
+8
View File
@@ -1298,6 +1298,14 @@ class ChatController extends Controller
'font_color' => '#b45309',
'action' => '',
'sent_at' => now()->toDateTimeString(),
// 接收方收到消息时,在右下角弹到账提示卡片。
'toast_notification' => [
'title' => '💰 赠金币到账',
'message' => "<b>{$sender->username}</b> 向你赠送了 <b>{$amount}</b> 枚金币!",
'icon' => '💰',
'color' => '#f59e0b',
'duration' => 8000,
],
];
// 推入 Redis + WebSocket + 异步落库,保持与普通私聊一致的展示与历史记录行为。
+3
View File
@@ -309,6 +309,9 @@ class ChatControllerTest extends TestCase
$this->assertNotNull($giftMessage);
$this->assertTrue((bool) ($giftMessage['is_secret'] ?? false));
$this->assertSame('💰 赠金币到账', $giftMessage['toast_notification']['title'] ?? null);
$this->assertSame('💰', $giftMessage['toast_notification']['icon'] ?? null);
$this->assertSame('#f59e0b', $giftMessage['toast_notification']['color'] ?? null);
// 赠送方查看房间历史时,应保留这条私聊通知。
$senderHistory = $this->actingAs($sender)