From 0e8a1669b9141a55ce0813f1b3c625857170b645 Mon Sep 17 00:00:00 2001 From: lkddi Date: Fri, 17 Apr 2026 15:27:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=A5=9E=E7=A7=98?= =?UTF-8?q?=E7=AE=B1=E5=AD=90=E7=9A=84=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/partials/layout/input-bar.blade.php | 6 ++++++ resources/views/chat/partials/scripts.blade.php | 17 +++++++++++++++-- tests/Feature/ChatControllerTest.php | 1 + tests/Feature/UserControllerTest.php | 11 ++++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/resources/views/chat/partials/layout/input-bar.blade.php b/resources/views/chat/partials/layout/input-bar.blade.php index b9d8842..2d4fca3 100644 --- a/resources/views/chat/partials/layout/input-bar.blade.php +++ b/resources/views/chat/partials/layout/input-bar.blade.php @@ -146,6 +146,12 @@ $welcomeMessages = [ onchange="toggleBlockedSystemSender('跑马', this.checked)"> 跑马 + diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 65eb677..1251d90 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -39,7 +39,7 @@ const onlineCountBottom = document.getElementById('online-count-bottom'); const BLOCKED_SYSTEM_SENDERS_STORAGE_KEY = 'chat_blocked_system_senders'; const CHAT_SOUND_MUTED_STORAGE_KEY = 'chat_sound_muted'; - const BLOCKABLE_SYSTEM_SENDERS = ['钓鱼播报', '星海小博士', '百家乐', '跑马','神秘箱子']; + const BLOCKABLE_SYSTEM_SENDERS = ['钓鱼播报', '星海小博士', '百家乐', '跑马', '神秘箱子']; // ── 消息区:手机端双触发打开用户名片(PC 端靠 ondblclick 内联属性)── // span[data-u] 由 clickableUser() 生成,touchend 委托至容器避免每条消息单独绑定 @@ -200,6 +200,7 @@ const doctorCheckbox = document.getElementById('block-sender-doctor'); const baccaratCheckbox = document.getElementById('block-sender-baccarat'); const horseRaceCheckbox = document.getElementById('block-sender-horse-race'); + const mysteryBoxCheckbox = document.getElementById('block-sender-mystery-box'); if (fishingCheckbox) { fishingCheckbox.checked = blockedSystemSenders.has('钓鱼播报'); @@ -216,6 +217,10 @@ if (horseRaceCheckbox) { horseRaceCheckbox.checked = blockedSystemSenders.has('跑马'); } + + if (mysteryBoxCheckbox) { + mysteryBoxCheckbox.checked = blockedSystemSenders.has('神秘箱子'); + } } /** @@ -232,10 +237,18 @@ return '钓鱼播报'; } + if (fromUser === '神秘箱子') { + return '神秘箱子'; + } + if (fromUser === '星海小博士') { return '星海小博士'; } + if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('神秘箱子')) { + return '神秘箱子'; + } + if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('百家乐')) { return '百家乐'; } @@ -952,7 +965,7 @@ let timeStrOverride = false; // 系统用户名列表(不可被选为聊天对象) - const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报']; + const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报', '神秘箱子']; // 动作文字映射表:情绪型(着/地,放"对"之前)和动作型(了,替换"对X说") const actionTextMap = { diff --git a/tests/Feature/ChatControllerTest.php b/tests/Feature/ChatControllerTest.php index 088a5c1..31a6c79 100644 --- a/tests/Feature/ChatControllerTest.php +++ b/tests/Feature/ChatControllerTest.php @@ -77,6 +77,7 @@ class ChatControllerTest extends TestCase $response->assertSee('星海小博士'); $response->assertSee('百家乐'); $response->assertSee('跑马'); + $response->assertSee('神秘箱子'); $response->assertSee('chat_blocked_system_senders'); $response->assertSee('toggleBlockedSystemSender'); } diff --git a/tests/Feature/UserControllerTest.php b/tests/Feature/UserControllerTest.php index 5bfd198..5577fe5 100644 --- a/tests/Feature/UserControllerTest.php +++ b/tests/Feature/UserControllerTest.php @@ -16,6 +16,10 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Redis; use Tests\TestCase; +/** + * 用户控制器功能测试 + * 覆盖个人资料、密码与聊天室偏好设置等关键接口。 + */ class UserControllerTest extends TestCase { use RefreshDatabase; @@ -141,19 +145,20 @@ class UserControllerTest extends TestCase ]); $response = $this->actingAs($user)->putJson('/user/chat-preferences', [ - 'blocked_system_senders' => ['钓鱼播报', '跑马'], + 'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'], 'sound_muted' => true, ]); $response->assertOk() ->assertJsonPath('status', 'success') ->assertJsonPath('data.blocked_system_senders.0', '钓鱼播报') - ->assertJsonPath('data.blocked_system_senders.1', '跑马') + ->assertJsonPath('data.blocked_system_senders.1', '神秘箱子') + ->assertJsonPath('data.blocked_system_senders.2', '跑马') ->assertJsonPath('data.sound_muted', true); $user->refresh(); $this->assertEquals([ - 'blocked_system_senders' => ['钓鱼播报', '跑马'], + 'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'], 'sound_muted' => true, ], $user->chat_preferences); }