增加 神秘箱子的屏蔽

This commit is contained in:
2026-04-17 15:27:40 +08:00
parent 0f4de941db
commit 0e8a1669b9
4 changed files with 30 additions and 5 deletions
@@ -146,6 +146,12 @@ $welcomeMessages = [
onchange="toggleBlockedSystemSender('跑马', this.checked)"> onchange="toggleBlockedSystemSender('跑马', this.checked)">
跑马 跑马
</label> </label>
<label
style="display:flex;align-items:center;gap:6px;font-size:12px;color:#1e293b;cursor:pointer;padding:4px 2px;">
<input type="checkbox" id="block-sender-mystery-box"
onchange="toggleBlockedSystemSender('神秘箱子', this.checked)">
神秘箱子
</label>
</div> </div>
</div> </div>
@@ -200,6 +200,7 @@
const doctorCheckbox = document.getElementById('block-sender-doctor'); const doctorCheckbox = document.getElementById('block-sender-doctor');
const baccaratCheckbox = document.getElementById('block-sender-baccarat'); const baccaratCheckbox = document.getElementById('block-sender-baccarat');
const horseRaceCheckbox = document.getElementById('block-sender-horse-race'); const horseRaceCheckbox = document.getElementById('block-sender-horse-race');
const mysteryBoxCheckbox = document.getElementById('block-sender-mystery-box');
if (fishingCheckbox) { if (fishingCheckbox) {
fishingCheckbox.checked = blockedSystemSenders.has('钓鱼播报'); fishingCheckbox.checked = blockedSystemSenders.has('钓鱼播报');
@@ -216,6 +217,10 @@
if (horseRaceCheckbox) { if (horseRaceCheckbox) {
horseRaceCheckbox.checked = blockedSystemSenders.has('跑马'); horseRaceCheckbox.checked = blockedSystemSenders.has('跑马');
} }
if (mysteryBoxCheckbox) {
mysteryBoxCheckbox.checked = blockedSystemSenders.has('神秘箱子');
}
} }
/** /**
@@ -232,10 +237,18 @@
return '钓鱼播报'; return '钓鱼播报';
} }
if (fromUser === '神秘箱子') {
return '神秘箱子';
}
if (fromUser === '星海小博士') { if (fromUser === '星海小博士') {
return '星海小博士'; return '星海小博士';
} }
if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('神秘箱子')) {
return '神秘箱子';
}
if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('百家乐')) { if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('百家乐')) {
return '百家乐'; return '百家乐';
} }
@@ -952,7 +965,7 @@
let timeStrOverride = false; let timeStrOverride = false;
// 系统用户名列表(不可被选为聊天对象) // 系统用户名列表(不可被选为聊天对象)
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报']; const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报', '神秘箱子'];
// 动作文字映射表:情绪型(着/地,放"对"之前)和动作型(了,替换"对X说" // 动作文字映射表:情绪型(着/地,放"对"之前)和动作型(了,替换"对X说"
const actionTextMap = { const actionTextMap = {
+1
View File
@@ -77,6 +77,7 @@ class ChatControllerTest extends TestCase
$response->assertSee('星海小博士'); $response->assertSee('星海小博士');
$response->assertSee('百家乐'); $response->assertSee('百家乐');
$response->assertSee('跑马'); $response->assertSee('跑马');
$response->assertSee('神秘箱子');
$response->assertSee('chat_blocked_system_senders'); $response->assertSee('chat_blocked_system_senders');
$response->assertSee('toggleBlockedSystemSender'); $response->assertSee('toggleBlockedSystemSender');
} }
+8 -3
View File
@@ -16,6 +16,10 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
use Tests\TestCase; use Tests\TestCase;
/**
* 用户控制器功能测试
* 覆盖个人资料、密码与聊天室偏好设置等关键接口。
*/
class UserControllerTest extends TestCase class UserControllerTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
@@ -141,19 +145,20 @@ class UserControllerTest extends TestCase
]); ]);
$response = $this->actingAs($user)->putJson('/user/chat-preferences', [ $response = $this->actingAs($user)->putJson('/user/chat-preferences', [
'blocked_system_senders' => ['钓鱼播报', '跑马'], 'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'],
'sound_muted' => true, 'sound_muted' => true,
]); ]);
$response->assertOk() $response->assertOk()
->assertJsonPath('status', 'success') ->assertJsonPath('status', 'success')
->assertJsonPath('data.blocked_system_senders.0', '钓鱼播报') ->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); ->assertJsonPath('data.sound_muted', true);
$user->refresh(); $user->refresh();
$this->assertEquals([ $this->assertEquals([
'blocked_system_senders' => ['钓鱼播报', '跑马'], 'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'],
'sound_muted' => true, 'sound_muted' => true,
], $user->chat_preferences); ], $user->chat_preferences);
} }