新增:管理员命令系统(警告/踢出/禁言/冻结/查看私信/站长公屏)
- 新建 AdminCommandController 处理6个管理操作命令
- 注册管理员命令路由 /command/*
- 更新 UserKicked 事件增加原因字段
- 更新 UserMuted 事件支持自定义提示消息
- 重构用户名片弹窗管理面板:警告/踢出/禁言/冻结按钮
- 站长专属:查看私信记录、📢公屏讲话按钮
- 被踢出时显示踢出原因
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* 文件功能:用户被踢出房间广播事件
|
||||
*
|
||||
* 管理员踢出/冻结用户时触发,前端监听后强制该用户跳转至大厅。
|
||||
*
|
||||
* @author ChatRoom Laravel
|
||||
*
|
||||
* @version 1.0.0
|
||||
@@ -21,18 +23,20 @@ class UserKicked implements ShouldBroadcast
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
* 构造函数
|
||||
*
|
||||
* @param int $roomId 房间ID
|
||||
* @param string $username 被踢出的用户昵称
|
||||
* @param string $reason 踢出原因
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $roomId,
|
||||
public readonly string $username,
|
||||
public readonly string $reason = '',
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
* 广播频道
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
@@ -44,7 +48,7 @@ class UserKicked implements ShouldBroadcast
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取广播时的数据
|
||||
* 广播数据
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -52,7 +56,7 @@ class UserKicked implements ShouldBroadcast
|
||||
{
|
||||
return [
|
||||
'username' => $this->username,
|
||||
'message' => "用户 [{$this->username}] 已被踢出聊天室。",
|
||||
'reason' => $this->reason,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user