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
b6efe36f
Commit
b6efe36f
authored
Jul 01, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 判断是否已经存在会话
// 两个用户如果已经创建过会话,不能重复创建会话 返回已存在的会话id // size() == 1 为单聊的时候不允许重复创建
parent
fa6458c9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
45 deletions
+42
-45
common/pom.xml
+11
-11
common/src/main/java/com/wecloud/im/mapper/ImConversationMapper.java
+10
-0
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+9
-1
common/src/main/resources/mapper/ImConversationMapper.xml
+12
-0
config/src/main/resources/config/application.yml
+0
-33
No files found.
common/pom.xml
View file @
b6efe36f
...
...
@@ -70,17 +70,17 @@
<!-- 公众号(包括订阅号和服务号):weixin-java-mp -->
<
dependency
>
<groupId>
com.github.binarywang
</groupId
>
<artifactId>
weixin-java-mp
</artifactId
>
<version>
4.0.0
</version
>
<
/dependency
>
<
dependency
>
<groupId>
com.github.binarywang
</groupId
>
<artifactId>
weixin-java-pay
</artifactId
>
<version>
4.0.0
</version
>
<
/dependency
>
<
!-- <dependency>--
>
<!-- <groupId>com.github.binarywang</groupId>--
>
<!-- <artifactId>weixin-java-mp</artifactId>--
>
<!-- <version>4.0.0</version>--
>
<
!-- </dependency>--
>
<
!-- <dependency>--
>
<!-- <groupId>com.github.binarywang</groupId>--
>
<!-- <artifactId>weixin-java-pay</artifactId>--
>
<!-- <version>4.0.0</version>--
>
<
!-- </dependency>--
>
<!-- fastbootWeixin的核心依赖 -->
...
...
common/src/main/java/com/wecloud/im/mapper/ImConversationMapper.java
View file @
b6efe36f
...
...
@@ -64,4 +64,14 @@ public interface ImConversationMapper extends BaseMapper<ImConversation> {
* @return
*/
Integer
getRepetitionConversation
(
@Param
(
"clientId1"
)
Long
clientId1
,
@Param
(
"clientId2"
)
Long
clientId2
);
/**
* 查询已经存在的会话信息
*
* @param clientId1
* @param clientId2
* @return
*/
ImConversation
getRepetitionConversationInfo
(
@Param
(
"clientId1"
)
Long
clientId1
,
@Param
(
"clientId2"
)
Long
clientId2
);
}
common/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
b6efe36f
...
...
@@ -90,15 +90,23 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 判断是否已经存在会话
// 两个用户如果已经创建过会话,不能重复创建会话
// size() == 1 为单聊的时候不允许重复创建
if
(
imConversationCreate
.
getClientIds
().
size
()
==
1
)
{
ImClient
client2
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
.
eq
(
ImClient:
:
getFkAppid
,
client
.
getFkAppid
())
.
eq
(
ImClient:
:
getClientId
,
imConversationCreate
.
getClientIds
().
get
(
0
)));
// 是否存在重复会话
Integer
repetitionConversation
=
getRepetitionConversation
(
client
.
getId
(),
client2
.
getId
());
if
(
repetitionConversation
!=
0
)
{
log
.
debug
(
"repetitionConversation != 0"
);
return
ApiResult
.
result
(
ApiCode
.
REPETITION_CONVERSATION
,
null
);
// 返回已存在的会话id
ImConversation
repetitionConversationInfo
=
imConversationMapper
.
getRepetitionConversationInfo
(
client
.
getId
(),
client2
.
getId
());
ImConversationCreateVo
imConversationCreateVo
=
new
ImConversationCreateVo
();
imConversationCreateVo
.
setId
(
repetitionConversationInfo
.
getId
());
return
ApiResult
.
result
(
ApiCode
.
REPETITION_CONVERSATION
,
imConversationCreateVo
);
}
}
...
...
common/src/main/resources/mapper/ImConversationMapper.xml
View file @
b6efe36f
...
...
@@ -71,5 +71,17 @@
) AS r1
WHERE members_count = 2
</select>
<select
id=
"getRepetitionConversationInfo"
resultType=
"com.wecloud.im.entity.ImConversation"
>
SELECT im_conversation.*
FROM im_conversation_members
INNER JOIN (SELECT *
FROM im_conversation_members
WHERE im_conversation_members.fk_client_id = #{clientId2}) AS im_conversation_members2
ON im_conversation_members.fk_conversation_id = im_conversation_members2.fk_conversation_id
INNER JOIN im_conversation ON im_conversation.id = im_conversation_members.fk_conversation_id
WHERE im_conversation_members.fk_client_id = #{clientId1}
</select>
</mapper>
config/src/main/resources/config/application.yml
View file @
b6efe36f
...
...
@@ -257,39 +257,6 @@ mybatis-plus:
mapper-locations
:
classpath*:mapper/**/*Mapper.xml
################################ mybatis-plus end ##################################
wx
:
# token: sDsdaSDADad
# # 测试号的appid,测试号管理界面有
# appid: wx7aac805012428dc5
# # 测试号的appsecret,测试号管理界面有
# appsecret:
# # =服务调用的url地址,用于微信web的oauth2授权回调等,若没有可为空。
# callback-url: wx7aac805012428dc5
#
mp
:
useRedis
:
false
redisConfig
:
host
:
127.0.0.1
port
:
6379
configs
:
-
appId
:
wxe4a696e431b0456b
# 第一个公众号的appid
secret
:
87dbca535a713cd505be2f928fa84c29
# 公众号的appsecret
token
:
111
# 接口配置里的Token值
aesKey
:
111
# 接口配置里的EncodingAESKey值
-
appId
:
2222
# 第二个公众号的appid,以下同上
secret
:
1111
token
:
111
aesKey
:
111
pay
:
appId
:
wxe4a696e431b0456b
#微信公众号或者小程序等的appid
mchId
:
1606818547
#微信支付商户号
mchKey
:
H0p6dhiXRr5FocmzZluNVqyG7QALISj1
#微信支付商户密钥
# subAppId: #服务商模式下的子商户公众账号ID
# subMchId: #服务商模式下的子商户号
keyPath
:
classpath:src/main/java/io/geekidea/springbootplus/config/properties/apiclient_cert.p12
# p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
############################### HikariCP 数据源配置 start ################################
...
...
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