功能:管理员全员清屏 + 离开提示趣味风格

- 新增 ScreenCleared 广播事件
- AdminCommandController 添加 clearScreen 方法(站长权限)
- ChatStateService 添加 clearMessages 方法
- chat.js 添加 ScreenCleared Echo 监听
- 前端:全员清屏按钮(红色🧹)+ 清屏处理逻辑(保留悄悄话)
- 离开提示改为与进入一致的趣味随机语风格(橙色【离开】标签)
This commit is contained in:
2026-02-26 23:05:56 +08:00
parent b80a74655c
commit 66f68bab85
7 changed files with 201 additions and 4 deletions

View File

@@ -104,6 +104,17 @@ class ChatStateService
Redis::ltrim($key, -$maxKeep, -1);
}
/**
* 清除指定房间的所有消息缓存(管理员全员清屏)。
*
* @param int $roomId 房间ID
*/
public function clearMessages(int $roomId): void
{
$key = "room:{$roomId}:messages";
Redis::del($key);
}
/**
* 获取指定房间的新发言记录。
* 在高频长轮询或前端断线重连拉取时使用。