Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
bad888c7
Commit
bad888c7
authored
Feb 10, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
离开频道处理逻辑调整
parent
3bc65374
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
core/src/main/java/com/wecloud/im/controller/ImRtcController.java
+6
-0
core/src/main/java/com/wecloud/rtc/service/MangerRtcCacheService.java
+1
-1
core/src/main/java/com/wecloud/rtc/service/impl/MangerRtcCacheServiceImpl.java
+2
-5
core/src/main/java/com/wecloud/rtc/service/impl/WsRtcWriteImpl.java
+0
-4
No files found.
core/src/main/java/com/wecloud/im/controller/ImRtcController.java
View file @
bad888c7
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
);
}
...
...
core/src/main/java/com/wecloud/rtc/service/MangerRtcCacheService.java
View file @
bad888c7
...
...
@@ -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
;
/**
* 加入频道
...
...
core/src/main/java/com/wecloud/rtc/service/impl/MangerRtcCacheServiceImpl.java
View file @
bad888c7
...
...
@@ -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
);
}
...
...
core/src/main/java/com/wecloud/rtc/service/impl/WsRtcWriteImpl.java
View file @
bad888c7
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment