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
eb30b63b
Commit
eb30b63b
authored
Apr 25, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多人音视频拉黑逻辑
parent
f0a2fdff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletions
+42
-1
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
+10
-0
core/src/main/java/com/wecloud/multimeet/service/impl/MultiMeetServiceImpl.java
+32
-0
core/src/main/java/com/wecloud/rtc/service/impl/MangerRtcCacheServiceImpl.java
+0
-1
No files found.
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
View file @
eb30b63b
package
com
.
wecloud
.
im
.
friend
.
controller
;
package
com
.
wecloud
.
im
.
friend
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.friend.param.ImCreateRecommendParam
;
import
com.wecloud.im.friend.param.ImCreateRecommendParam
;
import
com.wecloud.im.friend.param.ImDeleteFriendParam
;
import
com.wecloud.im.friend.param.ImDeleteFriendParam
;
...
@@ -58,6 +59,7 @@ public class ImFriendController extends BaseController {
...
@@ -58,6 +59,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/info"
)
@PostMapping
(
"/info"
)
@ApiOperation
(
value
=
"查询好友信息,只有自己的好友才查得到"
)
@ApiOperation
(
value
=
"查询好友信息,只有自己的好友才查得到"
)
public
ApiResult
<
ImFriendApplyDto
>
getFriendInfo
(
@RequestBody
ImFriendBaseParam
param
)
{
public
ApiResult
<
ImFriendApplyDto
>
getFriendInfo
(
@RequestBody
ImFriendBaseParam
param
)
{
log
.
info
(
"查询好友信息入参 {}"
,
JSON
.
toJSONString
(
param
));
if
(
param
==
null
)
{
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
...
@@ -79,6 +81,7 @@ public class ImFriendController extends BaseController {
...
@@ -79,6 +81,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/apply"
)
@PostMapping
(
"/apply"
)
@ApiOperation
(
value
=
"申请添加好友"
)
@ApiOperation
(
value
=
"申请添加好友"
)
public
ApiResult
<
Boolean
>
applyFriend
(
@RequestBody
ImFriendApplyParam
param
)
{
public
ApiResult
<
Boolean
>
applyFriend
(
@RequestBody
ImFriendApplyParam
param
)
{
log
.
info
(
"申请添加好友入参 {}"
,
JSON
.
toJSONString
(
param
));
if
(
param
==
null
)
{
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
...
@@ -117,6 +120,7 @@ public class ImFriendController extends BaseController {
...
@@ -117,6 +120,7 @@ public class ImFriendController extends BaseController {
@GetMapping
(
"/sdk/unsureFriends"
)
@GetMapping
(
"/sdk/unsureFriends"
)
@ApiOperation
(
value
=
"获取好友请求列表,最多只返回1000个"
)
@ApiOperation
(
value
=
"获取好友请求列表,最多只返回1000个"
)
public
ApiResult
<
List
<
ImFriendApplyDto
>>
getUnsureFriendsSdk
(
@RequestParam
(
"clientId"
)
String
clientId
)
{
public
ApiResult
<
List
<
ImFriendApplyDto
>>
getUnsureFriendsSdk
(
@RequestParam
(
"clientId"
)
String
clientId
)
{
log
.
info
(
"获取好友请求列表入参 {}"
,
clientId
);
Long
appId
=
SecurityUtils
.
getCurrentAppId
();
Long
appId
=
SecurityUtils
.
getCurrentAppId
();
ImClient
imClient
=
imClientService
.
getCacheImClient
(
appId
,
clientId
);
ImClient
imClient
=
imClientService
.
getCacheImClient
(
appId
,
clientId
);
List
<
ImFriendApplyDto
>
applyFriends
=
imFriendService
.
getApplyFriends
(
imClient
);
List
<
ImFriendApplyDto
>
applyFriends
=
imFriendService
.
getApplyFriends
(
imClient
);
...
@@ -130,6 +134,7 @@ public class ImFriendController extends BaseController {
...
@@ -130,6 +134,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/approve"
)
@PostMapping
(
"/approve"
)
@ApiOperation
(
value
=
"接受/拒绝好友申请"
)
@ApiOperation
(
value
=
"接受/拒绝好友申请"
)
public
ApiResult
<
Boolean
>
approveFriend
(
@RequestBody
ImFriendApproveParam
param
)
{
public
ApiResult
<
Boolean
>
approveFriend
(
@RequestBody
ImFriendApproveParam
param
)
{
log
.
info
(
"接受/拒绝好友申请入参 {}"
,
JSON
.
toJSONString
(
param
));
if
(
param
==
null
||
param
.
getAgree
()
==
null
)
{
if
(
param
==
null
||
param
.
getAgree
()
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
...
@@ -153,6 +158,7 @@ public class ImFriendController extends BaseController {
...
@@ -153,6 +158,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/batchDelete"
)
@PostMapping
(
"/batchDelete"
)
@ApiOperation
(
value
=
"删除好友"
)
@ApiOperation
(
value
=
"删除好友"
)
public
ApiResult
<
Boolean
>
batchDeleteFriend
(
@RequestBody
ImDeleteFriendParam
param
)
{
public
ApiResult
<
Boolean
>
batchDeleteFriend
(
@RequestBody
ImDeleteFriendParam
param
)
{
log
.
info
(
"删除好友入参 {}"
,
JSON
.
toJSONString
(
param
));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
...
@@ -169,6 +175,7 @@ public class ImFriendController extends BaseController {
...
@@ -169,6 +175,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"好友分页列表"
,
type
=
OperationLogType
.
PAGE
)
@OperationLog
(
name
=
"好友分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"好友分页列表"
)
@ApiOperation
(
value
=
"好友分页列表"
)
public
ApiResult
<
Paging
<
ImFriendBaseDto
>>
getImFriendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
public
ApiResult
<
Paging
<
ImFriendBaseDto
>>
getImFriendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
log
.
info
(
"好友分页列表入参 {}"
,
JSON
.
toJSONString
(
pageParam
));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
...
@@ -185,6 +192,7 @@ public class ImFriendController extends BaseController {
...
@@ -185,6 +192,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"批量创建好友推荐"
,
type
=
OperationLogType
.
PAGE
)
@OperationLog
(
name
=
"批量创建好友推荐"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"批量创建好友推荐"
)
@ApiOperation
(
value
=
"批量创建好友推荐"
)
public
ApiResult
<
Boolean
>
batchCreateRecommend
(
@RequestBody
ImCreateRecommendParam
param
)
{
public
ApiResult
<
Boolean
>
batchCreateRecommend
(
@RequestBody
ImCreateRecommendParam
param
)
{
log
.
info
(
"批量创建好友推荐入参 {}"
,
JSON
.
toJSONString
(
param
));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
...
@@ -208,6 +216,7 @@ public class ImFriendController extends BaseController {
...
@@ -208,6 +216,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"好友推荐分页列表"
,
type
=
OperationLogType
.
PAGE
)
@OperationLog
(
name
=
"好友推荐分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"好友推荐分页列表"
)
@ApiOperation
(
value
=
"好友推荐分页列表"
)
public
ApiResult
<
Paging
<
ImFriendRecommendDto
>>
getImFriendRecommendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
public
ApiResult
<
Paging
<
ImFriendRecommendDto
>>
getImFriendRecommendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
log
.
info
(
"好友推荐分页列表入参 {}"
,
JSON
.
toJSONString
(
pageParam
));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
...
@@ -223,6 +232,7 @@ public class ImFriendController extends BaseController {
...
@@ -223,6 +232,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/recommend/batchDelete"
)
@PostMapping
(
"/recommend/batchDelete"
)
@ApiOperation
(
value
=
"删除好友推荐"
)
@ApiOperation
(
value
=
"删除好友推荐"
)
public
ApiResult
<
Boolean
>
batchDeleteRecommend
(
@RequestBody
ImDeleteRecommendParam
param
)
{
public
ApiResult
<
Boolean
>
batchDeleteRecommend
(
@RequestBody
ImDeleteRecommendParam
param
)
{
log
.
info
(
"删除好友推荐入参 {}"
,
JSON
.
toJSONString
(
param
));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
...
...
core/src/main/java/com/wecloud/multimeet/service/impl/MultiMeetServiceImpl.java
View file @
eb30b63b
package
com
.
wecloud
.
multimeet
.
service
.
impl
;
package
com
.
wecloud
.
multimeet
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.wecloud.im.service.ImClientBlacklistService
;
import
io.geekidea.springbootplus.framework.common.exception.BusinessException
;
import
io.geekidea.springbootplus.framework.common.exception.BusinessException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -64,6 +66,9 @@ public class MultiMeetServiceImpl implements MultiMeetService {
...
@@ -64,6 +66,9 @@ public class MultiMeetServiceImpl implements MultiMeetService {
@Autowired
@Autowired
private
ImMultiRtcRoomMemberService
imMultiRtcRoomMemberService
;
private
ImMultiRtcRoomMemberService
imMultiRtcRoomMemberService
;
@Autowired
private
ImClientBlacklistService
imClientBlacklistService
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
invite
(
InviteToMultiMeetParam
param
)
{
public
void
invite
(
InviteToMultiMeetParam
param
)
{
...
@@ -119,6 +124,10 @@ public class MultiMeetServiceImpl implements MultiMeetService {
...
@@ -119,6 +124,10 @@ public class MultiMeetServiceImpl implements MultiMeetService {
log
.
info
(
"查无接收人信息 {}"
,
toClientId
);
log
.
info
(
"查无接收人信息 {}"
,
toClientId
);
continue
;
continue
;
}
}
// 拉黑逻辑
if
(
black
(
currentClient
,
toClient
))
{
continue
;
}
// 占线 通知邀请方
// 占线 通知邀请方
List
<
ImMultiRtcRoomMember
>
busyMember
=
imMultiRtcRoomMemberService
.
list
(
new
QueryWrapper
<
ImMultiRtcRoomMember
>().
lambda
()
List
<
ImMultiRtcRoomMember
>
busyMember
=
imMultiRtcRoomMemberService
.
list
(
new
QueryWrapper
<
ImMultiRtcRoomMember
>().
lambda
()
.
eq
(
ImMultiRtcRoomMember:
:
getClientId
,
toClientId
)
.
eq
(
ImMultiRtcRoomMember:
:
getClientId
,
toClientId
)
...
@@ -365,4 +374,27 @@ public class MultiMeetServiceImpl implements MultiMeetService {
...
@@ -365,4 +374,27 @@ public class MultiMeetServiceImpl implements MultiMeetService {
imMultiRtcRoomMemberService
.
updateBatchById
(
rtcRoomMemberList
);
imMultiRtcRoomMemberService
.
updateBatchById
(
rtcRoomMemberList
);
}
}
/**
* 拉黑逻辑
*
* @param currentClient
* @param toClient
* @return
*/
private
boolean
black
(
ImClient
currentClient
,
ImClient
toClient
)
{
// 判断是否被拉黑
boolean
beBlack
=
imClientBlacklistService
.
isBeBlack
(
toClient
.
getClientId
(),
currentClient
.
getClientId
());
if
(
beBlack
)
{
log
.
info
(
"被对方拉黑了 currentClient: {} toClient: {} "
,
JSON
.
toJSONString
(
currentClient
),
JSON
.
toJSONString
(
toClient
));
return
true
;
}
// 是否把对方拉黑
boolean
black
=
imClientBlacklistService
.
isBeBlack
(
currentClient
.
getClientId
(),
toClient
.
getClientId
());
if
(
black
)
{
log
.
info
(
"你把对方拉黑了 currentClient: {} toClient: {} "
,
JSON
.
toJSONString
(
currentClient
),
JSON
.
toJSONString
(
toClient
));
return
true
;
}
return
false
;
}
}
}
core/src/main/java/com/wecloud/rtc/service/impl/MangerRtcCacheServiceImpl.java
View file @
eb30b63b
...
@@ -55,7 +55,6 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
...
@@ -55,7 +55,6 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
@Override
@Override
public
void
create
(
Long
clientId
,
Long
toClientId
,
Long
rtcChannelId
)
{
public
void
create
(
Long
clientId
,
Long
toClientId
,
Long
rtcChannelId
)
{
// --- 频道信息
// --- 频道信息
RtcChannelInfo
rtcChannelInfo
=
new
RtcChannelInfo
();
RtcChannelInfo
rtcChannelInfo
=
new
RtcChannelInfo
();
...
...
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