feat: 好友系统全实现
后端:
- FriendController:add/remove/status/index 四个接口
- FriendAdded / FriendRemoved 广播事件(私有频道)
- channels.php 注册 user.{username} 私有频道鉴权
- routes/web.php 注册好友路由
- ChatController::init() 修复 DutyLog 在 return 后执行的 bug
- ChatController::notifyFriendsOnline() 上线时悄悄话通知好友
前端:
- user-actions:写私信 → 加好友/删好友按钮(动态状态)
- toggleFriend() 方法 + fetchUser 后加载好友状态
- scripts:监听私有频道 FriendAdded/FriendRemoved
- showFriendToast() 右下角浮窗通知(5秒自动消失)
- global-dialog 加 fdSlideIn 动画
This commit is contained in:
@@ -26,3 +26,9 @@ Broadcast::channel('room.{roomId}', function ($user, $roomId) {
|
||||
'is_admin' => $user->user_level >= $superLevel,
|
||||
];
|
||||
});
|
||||
|
||||
// 用户私有频道鉴权(好友通知:FriendAdded / FriendRemoved)
|
||||
// 只有用户名匹配的本人才能订阅
|
||||
Broadcast::channel('user.{username}', function ($user, string $username) {
|
||||
return $user->username === $username;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user