视频会议
This commit is contained in:
@@ -41,6 +41,14 @@ type cloudLawCreateMeetingRequest struct {
|
||||
CallType string `json:"callType"`
|
||||
}
|
||||
|
||||
type cloudLawJoinMeetingRequest struct {
|
||||
ReceiverID int64 `json:"receiverId"`
|
||||
ReceiverType string `json:"receiverType"`
|
||||
ReceiverPhone string `json:"receiverPhone"`
|
||||
ReceiverName string `json:"receiverName"`
|
||||
CallID string `json:"callId"`
|
||||
}
|
||||
|
||||
func (ctl *MeetingController) requireCloudLawInternalToken(c *gin.Context) bool {
|
||||
expected := ""
|
||||
if ctl.meetingConfig != nil {
|
||||
@@ -270,6 +278,48 @@ func (ctl *MeetingController) CloudLawGetMeeting(c *gin.Context) {
|
||||
utils.ResponseOK(c, cloudLawMeetingPayload(room, onlineCount))
|
||||
}
|
||||
|
||||
func (ctl *MeetingController) CloudLawJoinMeeting(c *gin.Context) {
|
||||
if !ctl.requireCloudLawInternalToken(c) {
|
||||
return
|
||||
}
|
||||
code := c.Param("code")
|
||||
if code == "" {
|
||||
utils.ResponseBadRequest(c, "会议号不能为空")
|
||||
return
|
||||
}
|
||||
var req cloudLawJoinMeetingRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
utils.ResponseBadRequest(c, "参数校验失败: "+err.Error())
|
||||
return
|
||||
}
|
||||
req.ReceiverPhone = strings.TrimSpace(req.ReceiverPhone)
|
||||
req.ReceiverName = strings.TrimSpace(req.ReceiverName)
|
||||
if req.ReceiverPhone == "" {
|
||||
utils.ResponseBadRequest(c, "receiverPhone不能为空")
|
||||
return
|
||||
}
|
||||
user, created, err := ctl.meetingService.EnsureCloudLawUserByPhone(c.Request.Context(), req.ReceiverPhone, req.ReceiverName)
|
||||
if err != nil {
|
||||
ctl.handleError(c, err, "创建云律会议接单人失败")
|
||||
return
|
||||
}
|
||||
room, participant, _, err := ctl.meetingService.JoinRoomForInternal(c.Request.Context(), user.ID, code)
|
||||
if err != nil {
|
||||
ctl.handleError(c, err, "云律接单人加入会议失败")
|
||||
return
|
||||
}
|
||||
payload := cloudLawMeetingPayload(room, 0)
|
||||
payload["callId"] = req.CallID
|
||||
payload["receiverId"] = req.ReceiverID
|
||||
payload["receiverType"] = req.ReceiverType
|
||||
payload["echoChatParticipantUserId"] = strconv.FormatInt(user.ID, 10)
|
||||
payload["echoChatParticipantUserCreated"] = created
|
||||
if participant != nil {
|
||||
payload["participantId"] = strconv.FormatInt(participant.ID, 10)
|
||||
}
|
||||
utils.ResponseOK(c, payload)
|
||||
}
|
||||
|
||||
func (ctl *MeetingController) CloudLawEndMeeting(c *gin.Context) {
|
||||
if !ctl.requireCloudLawInternalToken(c) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user