Commit bad888c7 by Future

离开频道处理逻辑调整

parent 3bc65374
package com.wecloud.im.controller;
import com.wecloud.im.enums.CallTypeEnum;
import com.wecloud.im.param.rtc.CandidateForwardParam;
import com.wecloud.im.param.rtc.CreateRtcChannelParam;
import com.wecloud.im.param.rtc.CreateRtcChannelResult;
......@@ -8,8 +9,10 @@ import com.wecloud.im.param.rtc.LeaveRtcChannelParam;
import com.wecloud.im.param.rtc.RejectRtcChannelParam;
import com.wecloud.im.param.rtc.SdpForwardParam;
import com.wecloud.rtc.service.RtcService;
import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -40,6 +43,9 @@ public class ImRtcController extends BaseController {
@PostMapping("/createAndCall")
@ApiOperation(value = "创建频道,并邀请客户端加入", notes = "创建频道,并邀请客户端加入")
public ApiResult<CreateRtcChannelResult> createAndCall(@RequestBody CreateRtcChannelParam createRtcChannelParam) throws Exception {
if (BaseEnum.valueOf(CallTypeEnum.class, createRtcChannelParam.getCallType()) == null) {
return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION, null);
}
return rtcService.createAndCall(createRtcChannelParam);
}
......
......@@ -43,7 +43,7 @@ public interface MangerRtcCacheService {
* @param clientId
* @param rtcChannelId 雪花算法生成频道id
*/
void create(Long clientId, Long rtcChannelId) throws JsonProcessingException;
void create(Long clientId, Long toClientId, Long rtcChannelId) throws JsonProcessingException;
/**
* 加入频道
......
......@@ -54,7 +54,7 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
@Override
public void create(Long clientId, Long rtcChannelId) {
public void create(Long clientId, Long toClientId, Long rtcChannelId) {
// --- 频道信息
RtcChannelInfo rtcChannelInfo = new RtcChannelInfo();
......@@ -77,6 +77,7 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
//频道中存在的用户
String rtcChannelUsers = String.format(RtcRedisKey.RTC_CHANNEL_USERS, rtcChannelId);
redisUtils.addForSet(rtcChannelUsers, clientId + "", 10, TimeUnit.DAYS);
redisUtils.addForSet(rtcChannelUsers, toClientId + "", 10, TimeUnit.DAYS);
}
......@@ -86,10 +87,6 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
//用户当前在线的频道ID
String userJoinChannelKey = String.format(RtcRedisKey.USER_JOIN_CHANNEL, clientId);
redisUtils.addKey(userJoinChannelKey, rtcChannelId.toString(), Duration.ofDays(10));
//频道中存在的用户
String rtcChannelUsers = String.format(RtcRedisKey.RTC_CHANNEL_USERS, rtcChannelId);
redisUtils.addForSet(rtcChannelUsers, clientId + "", 10, TimeUnit.DAYS);
}
......
......@@ -35,7 +35,6 @@ public class WsRtcWriteImpl implements WsRtcWrite {
responseModel.setData(rtcCallResponse);
responseModel.setReqId(null);
channelSender.sendMsg(responseModel, toClientId);
}
@Override
......@@ -51,8 +50,6 @@ public class WsRtcWriteImpl implements WsRtcWrite {
responseModel.setData(rtcClientJoinResponse);
responseModel.setReqId(null);
channelSender.sendMsg(responseModel, toClientId);
}
@Override
......@@ -68,7 +65,6 @@ public class WsRtcWriteImpl implements WsRtcWrite {
responseModel.setData(rtcClientLeaveResponse);
responseModel.setReqId(null);
channelSender.sendMsg(responseModel, toClientId);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment