视频会议

This commit is contained in:
duoaohui
2026-05-21 19:01:25 +08:00
parent 3d7e64dfa9
commit fc20a97442
7 changed files with 150 additions and 3 deletions

View File

@@ -364,6 +364,39 @@ func (s *MeetingService) GetRoomByCode(ctx context.Context, userID int64, code s
return room, participants, activeCount, nil
}
func (s *MeetingService) GetRoomForInternal(ctx context.Context, code string) (*model.MeetingRoom, []model.MeetingParticipant, int64, error) {
room, err := s.roomDAO.GetByCode(ctx, code)
if err != nil {
return nil, nil, 0, err
}
if room == nil {
return nil, nil, 0, ErrMeetingNotFound
}
participants, err := s.participantDAO.ListByRoom(ctx, room.ID)
if err != nil {
return nil, nil, 0, err
}
activeCount, err := s.participantDAO.CountActiveByRoom(ctx, room.ID)
if err != nil {
return nil, nil, 0, err
}
return room, participants, activeCount, nil
}
func (s *MeetingService) EndRoomForInternal(ctx context.Context, code string) error {
room, err := s.roomDAO.GetByCode(ctx, code)
if err != nil {
return err
}
if room == nil {
return ErrMeetingNotFound
}
if room.Status == constants.MeetingStatusEnded {
return nil
}
return s.EndRoom(ctx, room.HostID, code)
}
// JoinRoom 加入会议
// 校验顺序:房间存在 → 未结束 → 单点参会 → 密码锁定 → 密码校验 → 容量 → 写 participant → 广播 meeting.member.joined
func (s *MeetingService) JoinRoom(ctx context.Context, userID int64, code, password string) (*model.MeetingRoom, *model.MeetingParticipant, string, error) {