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
a26c1a50
Commit
a26c1a50
authored
Aug 26, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量修改单向隐藏或显示会话
parent
c09b444f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
12 deletions
+16
-12
common/src/main/java/com/wecloud/im/controller/ImConversationController.java
+3
-4
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
+1
-2
common/src/main/java/com/wecloud/im/param/add/ImConversationDisplayUpdate.java
+3
-1
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+4
-3
common/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+4
-1
common/src/main/java/com/wecloud/im/ws/service/impl/MangerChannelServiceImpl.java
+1
-1
No files found.
common/src/main/java/com/wecloud/im/controller/ImConversationController.java
View file @
a26c1a50
...
...
@@ -58,10 +58,9 @@ public class ImConversationController extends BaseController {
*/
@PostMapping
(
"/displayUpdate"
)
@ApiOperation
(
value
=
"批量修改单向隐藏或显示会话"
,
notes
=
"拉取会话列表不展示已隐藏状态的会话,云端聊天记录不删除;假设有A和B两个用户,A删会话,B还能发; 如果B发了消息,A这边要重新把会话显示出来,并能显示之前的聊天记录"
)
public
ApiResult
<
Boolean
>
updateDisplayConversation
(
@RequestBody
List
<
ImConversationDisplayUpdate
>
imConversationDisplayUpdates
)
throws
Exception
{
for
(
ImConversationDisplayUpdate
imConversationDisplayUpdate
:
imConversationDisplayUpdates
)
{
boolean
flag
=
imConversationService
.
updateDisplayConversation
(
imConversationDisplayUpdate
);
}
public
ApiResult
<
Boolean
>
updateDisplayConversation
(
@RequestBody
ImConversationDisplayUpdate
imConversationDisplayUpdate
)
throws
Exception
{
imConversationService
.
updateDisplayConversation
(
imConversationDisplayUpdate
);
return
ApiResult
.
result
(
true
);
}
...
...
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
View file @
a26c1a50
...
...
@@ -110,9 +110,8 @@ public class WsReadHandler extends SimpleChannelInboundHandler<TextWebSocketFram
*/
@Override
public
void
channelInactive
(
ChannelHandlerContext
ctx
)
{
log
.
info
(
"客户端不活跃channelInactive"
);
String
userIdByChannel
=
mangerChannelService
.
getInfoByChannel
(
ctx
);
log
.
info
(
"uid:"
+
userIdByChannel
+
","
+
"
不活跃
"
+
",channelId:"
+
ctx
.
channel
().
id
().
asLongText
());
log
.
info
(
"uid:"
+
userIdByChannel
+
","
+
"
channelInactive
"
+
",channelId:"
+
ctx
.
channel
().
id
().
asLongText
());
}
/**
...
...
common/src/main/java/com/wecloud/im/param/add/ImConversationDisplayUpdate.java
View file @
a26c1a50
...
...
@@ -7,6 +7,8 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
/**
* 修改是否单向隐藏会话
*
...
...
@@ -21,7 +23,7 @@ public class ImConversationDisplayUpdate extends BaseEntity {
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"会话id"
,
required
=
true
)
private
L
ong
conversationId
;
private
L
ist
<
Long
>
conversationIds
;
@ApiModelProperty
(
value
=
"显示状态 1显示 0不显示"
,
required
=
true
)
private
Integer
displayStatus
;
...
...
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
a26c1a50
...
...
@@ -230,15 +230,16 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
public
boolean
updateDisplayConversation
(
ImConversationDisplayUpdate
imConversationDisplayUpdate
)
throws
Exception
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
for
(
Long
id
:
imConversationDisplayUpdate
.
getConversationIds
())
{
// 修改为删除隐藏状态
boolean
update
=
imConversationMembersService
.
update
(
new
UpdateWrapper
<
ImConversationMembers
>()
.
set
(
"display_status"
,
imConversationDisplayUpdate
.
getDisplayStatus
())
.
eq
(
"fk_client_id"
,
curentClient
.
getId
())
.
eq
(
"fk_conversation_id"
,
imConversationDisplayUpdate
.
getConversationId
()
)
.
eq
(
"fk_conversation_id"
,
id
)
.
eq
(
"fk_appid"
,
curentClient
.
getFkAppid
())
);
return
update
;
}
return
true
;
}
@Override
...
...
common/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
a26c1a50
...
...
@@ -167,13 +167,16 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
// 获取加入的所有会话
List
<
ImConversation
>
myImConversationList
=
imConversationService
.
getMyImConversationList
();
// 遍历会话列表, 查询每个会话列表的离线消息
for
(
ImConversation
imConversation
:
myImConversationList
)
{
//根据客户端id与会话id 查询离线消息
List
<
OfflineMsgDto
>
offlineListByClientAndConversation
=
this
.
getOfflineListByClientAndConversation
(
client
.
getId
(),
imConversation
.
getId
());
// 房间消息为空则不添加
if
(
offlineListByClientAndConversation
.
isEmpty
())
{
continue
;
}
ImMessageOfflineListVo
imMessageOfflineListVo
=
new
ImMessageOfflineListVo
();
imMessageOfflineListVo
.
setMsgList
(
offlineListByClientAndConversation
);
imMessageOfflineListVo
.
setConversationId
(
imConversation
.
getId
());
...
...
common/src/main/java/com/wecloud/im/ws/service/impl/MangerChannelServiceImpl.java
View file @
a26c1a50
...
...
@@ -62,7 +62,7 @@ public class MangerChannelServiceImpl implements MangerChannelService {
// 断掉旧链接
NioSocketChannel
nioSocketChannel
=
get
(
appKey
,
clientId
);
if
(
null
!=
nioSocketChannel
)
{
log
.
info
(
"put新连接关掉旧链接:"
+
appKey
+
","
+
clientId
+
",
"
+
",
\nchannelId:"
+
nioSocketChannel
.
id
().
asLongText
());
log
.
info
(
"put新连接关掉旧链接:"
+
appKey
+
","
+
clientId
+
",\nchannelId:"
+
nioSocketChannel
.
id
().
asLongText
());
nioSocketChannel
.
close
();
}
...
...
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