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
b260532f
Commit
b260532f
authored
Mar 03, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好友逻辑调整
parent
85b8c064
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
21 deletions
+36
-21
config/src/main/resources/config/application-dev.yml
+16
-8
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
+4
-2
core/src/main/java/com/wecloud/im/param/ImHistoryMessagePageParam.java
+5
-0
core/src/main/java/com/wecloud/im/service/ImMessageService.java
+2
-2
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+1
-3
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+5
-4
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
+2
-2
core/src/main/resources/mapper/ImMessageMapper.xml
+1
-0
No files found.
config/src/main/resources/config/application-dev.yml
View file @
b260532f
...
...
@@ -15,22 +15,30 @@ spring-boot-plus:
spring
:
datasource
:
url
:
jdbc:mysql://127.0.0.1:3306/wecloud-im?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
# url: jdbc:mysql://127.0.0.1:3306/wecloud-im?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
# username: root
# password: 123456
# 测试外网
url
:
jdbc:mysql://121.37.22.224:3306/wecloud_im_feature_cluster?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username
:
root
password
:
123456
password
:
temple
123456
#//测试外网
# url: jdbc:mysql://18.136.207.16:3306/wecloud_im?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
# username: web
# password: axT8knPN5hAP
# Redis配置
redis
:
# database: 0
# host: 127.0.0.1
# password:
# port: 6379
database
:
0
host
:
12
7.0.0.1
password
:
host
:
12
1.37.22.224
password
:
temple123456
port
:
6379
cloud
:
nacos
:
discovery
:
...
...
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
View file @
b260532f
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.friend.entity.ImFriend
;
...
...
@@ -137,7 +138,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
/**
* 根据 自己id和好友id查询好友信息
* 根据 自己id和好友id查询好友信息
- 待确认、已确认
* @param clientId
* @param friendClientId
* @return
...
...
@@ -145,7 +146,8 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
public
ImFriend
getByKey
(
String
clientId
,
String
friendClientId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
ImFriend
>().
lambda
()
.
eq
(
ImFriend:
:
getClientId
,
clientId
)
.
eq
(
ImFriend:
:
getClientIdFriend
,
friendClientId
));
.
eq
(
ImFriend:
:
getClientIdFriend
,
friendClientId
)
.
in
(
ImFriend:
:
getState
,
Lists
.
newArrayList
(
FriendStateEnum
.
UNSURE
.
getCode
(),
FriendStateEnum
.
CONFORM
.
getCode
())));
}
/**
...
...
core/src/main/java/com/wecloud/im/param/ImHistoryMessagePageParam.java
View file @
b260532f
...
...
@@ -36,4 +36,9 @@ public class ImHistoryMessagePageParam extends BasePageOrderParam {
*/
@ApiModelProperty
(
"消息id最大值"
)
private
Long
msgIdEnd
;
/**
* 当前操作人client主键id
*/
private
Long
currentFkClientId
;
}
core/src/main/java/com/wecloud/im/service/ImMessageService.java
View file @
b260532f
...
...
@@ -74,11 +74,11 @@ public interface ImMessageService extends BaseService<ImMessage> {
/**
* 查询某个会话历史消息分页列表
*
* @param
imHistoryMessagePageP
aram
* @param
p
aram
* @return
* @throws Exception
*/
Paging
<
OfflineMsgDto
>
getHistoryMsgConversationId
(
ImHistoryMessagePageParam
imHistoryMessagePageP
aram
);
Paging
<
OfflineMsgDto
>
getHistoryMsgConversationId
(
ImHistoryMessagePageParam
p
aram
);
/**
* 查询用户所有离线消息
...
...
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
b260532f
...
...
@@ -178,7 +178,6 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
return
ApiResult
.
ok
(
imConversationCreateVo
);
}
}
}
// 会话id
...
...
@@ -220,9 +219,8 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImClient
client2
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
.
eq
(
ImClient:
:
getFkAppid
,
createClient
.
getFkAppid
())
.
eq
(
ImClient:
:
getClientId
,
id
));
Long
imConversationMembersId2
=
SnowflakeUtil
.
getId
();
ImConversationMembers
imConversationMembers2
=
new
ImConversationMembers
();
imConversationMembers2
.
setId
(
imConversationMembersId2
);
imConversationMembers2
.
setId
(
SnowflakeUtil
.
getId
()
);
imConversationMembers2
.
setCreateTime
(
new
Date
());
imConversationMembers2
.
setFkAppid
(
createClient
.
getFkAppid
());
imConversationMembers2
.
setFkConversationId
(
imConversationId
);
...
...
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
b260532f
...
...
@@ -487,10 +487,11 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
}
@Override
public
Paging
<
OfflineMsgDto
>
getHistoryMsgConversationId
(
ImHistoryMessagePageParam
imHistoryMessagePageParam
)
{
Page
<
ImMessage
>
page
=
new
PageInfo
<>(
imHistoryMessagePageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
ImMessage:
:
getCreateTime
)));
IPage
<
OfflineMsgDto
>
iPage
=
imMessageMapper
.
getHistoryMsgConversationId
(
page
,
imHistoryMessagePageParam
);
public
Paging
<
OfflineMsgDto
>
getHistoryMsgConversationId
(
ImHistoryMessagePageParam
param
)
{
Page
<
ImMessage
>
page
=
new
PageInfo
<>(
param
,
OrderItem
.
desc
(
getLambdaColumn
(
ImMessage:
:
getCreateTime
)));
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
param
.
setCurrentFkClientId
(
currentClient
.
getId
());
IPage
<
OfflineMsgDto
>
iPage
=
imMessageMapper
.
getHistoryMsgConversationId
(
page
,
param
);
return
new
Paging
<>(
iPage
);
}
...
...
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
View file @
b260532f
...
...
@@ -60,10 +60,10 @@ public class UserStateCacheManager extends UserStateListener {
public
List
<
ClientChannelInfo
>
findOnlineInfosByClientId
(
Long
clientId
)
{
// 获取所有 CLIENTS的 <platform>:<ip>
Set
<
String
>
platformAndIs
=
redisUtils
.
getForSetMembers
(
getUserStateCacheKey
(
clientId
));
Set
<
String
>
platformAndI
p
s
=
redisUtils
.
getForSetMembers
(
getUserStateCacheKey
(
clientId
));
ArrayList
<
ClientChannelInfo
>
clientChannelInfos
=
new
ArrayList
<>();
for
(
String
platformAndIp
:
platformAndIs
)
{
for
(
String
platformAndIp
:
platformAndI
p
s
)
{
String
[]
split
=
platformAndIp
.
split
(
RedisUtils
.
SPLIT
);
ClientChannelInfo
clientChannelInfo
=
new
ClientChannelInfo
();
clientChannelInfo
.
setPlatform
(
Integer
.
valueOf
(
split
[
0
]));
...
...
core/src/main/resources/mapper/ImMessageMapper.xml
View file @
b260532f
...
...
@@ -73,6 +73,7 @@
FROM `im_message`
INNER JOIN `im_client` ON `im_client`.id = `im_message`.sender
WHERE fk_conversation_id = #{param.conversationId} and im_message.is_delete = 1 and im_message.withdraw = 0
and (im_message.`event`=0 || (im_message.`event`=1 and sender != #{currentFkClientId} ))
<if
test=
"param.msgIdStart != null"
>
AND im_message.id > #{param.msgIdStart}
</if>
...
...
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