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
bac597e0
Commit
bac597e0
authored
Aug 19, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 最后离线时间;
完成客户端自定义系统推送内容
parent
f518d744
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
137 additions
and
86 deletions
+137
-86
bootstrap/src/test/java/io/geekidea/springbootplus/test/LoginTest.java
+42
-43
common/src/main/java/com/wecloud/im/entity/ImClient.java
+3
-0
common/src/main/java/com/wecloud/im/ws/model/request/PushModel.java
+29
-0
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
+31
-21
common/src/main/java/com/wecloud/im/ws/strategy/AbstractReceiveStrategy.java
+2
-1
common/src/main/java/com/wecloud/im/ws/strategy/concrete/ImConcreteReceiveStrategy.java
+28
-20
common/src/main/resources/mapper/ImMessageMapper.xml
+2
-1
No files found.
bootstrap/src/test/java/io/geekidea/springbootplus/test/LoginTest.java
View file @
bac597e0
...
@@ -61,46 +61,45 @@ public class LoginTest {
...
@@ -61,46 +61,45 @@ public class LoginTest {
if
(
mySign
.
equals
(
sign
))
{
if
(
mySign
.
equals
(
sign
))
{
System
.
out
.
println
(
"一致"
+
mySign
);
System
.
out
.
println
(
"一致"
+
mySign
);
// return null;
// return null;
}
else
{
//
System
.
out
.
println
(
"不一致"
+
mySign
);
// }
return
null
;
//
// // 判断client是否存在
}
// ImClient client = imClientService.getOne(new QueryWrapper<ImClient>().lambda()
// .eq(ImClient::getFkAppid, imApplication.getId())
// 判断client是否存在
// .eq(ImClient::getClientId, clientId));
ImClient
client
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
//
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
// if (client == null) {
.
eq
(
ImClient:
:
getClientId
,
clientId
));
// System.out.println("不存在");
//
if
(
client
==
null
)
{
// ImClient imClient = new ImClient();
System
.
out
.
println
(
"不存在"
);
// imClient.setId(new Snowflake(1L, 1L).nextId());
// imClient.setFkAppid(imApplication.getId());
ImClient
imClient
=
new
ImClient
();
// imClient.setClientId(clientId);
imClient
.
setId
(
new
Snowflake
(
1L
,
1L
).
nextId
());
// imClientService.save(imClient);
imClient
.
setFkAppid
(
imApplication
.
getId
());
//
imClient
.
setClientId
(
clientId
);
// } else {
imClientService
.
save
(
imClient
);
// System.out.println("存在");
// }
}
else
{
//
System
.
out
.
println
(
"存在"
);
// // 生成token
}
// String generateToken = JwtUtil.generateToken(clientId, appKey, imApplication.getAppSecret(), Duration.ofDays(99999));
//
// 生成token
// // 保存redis
String
generateToken
=
JwtUtil
.
generateToken
(
clientId
,
appKey
,
imApplication
.
getAppSecret
(),
Duration
.
ofDays
(
99999
));
// redisTemplate.opsForValue().set("client:" + imApplication.getAppKey() + ":" + clientId, generateToken);
// return generateToken;
// 保存redis
// }
redisTemplate
.
opsForValue
().
set
(
"client:"
+
imApplication
.
getAppKey
()
+
":"
+
clientId
,
generateToken
);
//
return
generateToken
;
// @Test
}
// public void test() throws Exception {
// // 时间戳
@Test
// String timestamp = "1629274899016";
public
void
test
()
throws
Exception
{
// String clientId = "aaaaa2";
// 时间戳
// String sign = "a404fe25d383eb154b3b527f7213b35a";
String
timestamp
=
"1626665156369"
;
//
String
clientId
=
"aaaaa1"
;
//
String
appKey
=
"QNtP3EjtLw26ekt0"
;
// String appKey = "QNtP3EjtLw26ekt0";
String
sign
=
"a0b128928849c44bb0b7ae82944770b5"
;
// String token = getToken(timestamp, clientId, appKey, sign);
String
token
=
getToken
(
timestamp
,
clientId
,
appKey
,
sign
);
// System.out.println("token:\n" + token);
System
.
out
.
println
(
"token:"
+
token
);
// }
}
//}
}
common/src/main/java/com/wecloud/im/entity/ImClient.java
View file @
bac597e0
...
@@ -33,6 +33,9 @@ public class ImClient extends BaseEntity {
...
@@ -33,6 +33,9 @@ public class ImClient extends BaseEntity {
@ApiModelProperty
(
"创建时间"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
private
Date
createTime
;
@ApiModelProperty
(
"最后离线时间"
)
private
Date
lastOfflineTime
;
@ApiModelProperty
(
"修改时间"
)
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
private
Date
updateTime
;
...
...
common/src/main/java/com/wecloud/im/ws/model/request/PushModel.java
0 → 100644
View file @
bac597e0
package
com
.
wecloud
.
im
.
ws
.
model
.
request
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @Description 推送model
* @Author hewei hwei1233@163.com
* @Date 2019-12-05
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
PushModel
implements
Serializable
{
/**
* 标题
*/
private
String
title
;
/**
* 子标题
*/
private
String
subTitle
;
}
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
View file @
bac597e0
...
@@ -2,8 +2,8 @@ package com.wecloud.im.ws.sender;
...
@@ -2,8 +2,8 @@ package com.wecloud.im.ws.sender;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.push.PushUtils
;
import
com.wecloud.im.push.PushUtils
;
import
com.wecloud.im.ws.model.request.PushModel
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
...
@@ -15,6 +15,7 @@ import java.io.InputStreamReader;
...
@@ -15,6 +15,7 @@ import java.io.InputStreamReader;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.HashMap
;
/**
/**
* 异步系统推送
* 异步系统推送
...
@@ -28,22 +29,34 @@ public class PushTask {
...
@@ -28,22 +29,34 @@ public class PushTask {
*/
*/
private
static
final
String
API_URL_FCM
=
"https://fcm.googleapis.com/fcm/send"
;
private
static
final
String
API_URL_FCM
=
"https://fcm.googleapis.com/fcm/send"
;
//您收到一条新消息
/**
* 您收到一条新消息
*/
private
static
final
String
PUSH_TITLE
=
"You have received a new message"
;
private
static
final
String
PUSH_TITLE
=
"You have received a new message"
;
//点击查看
/**
* 点击查看
*/
private
static
final
String
PUSH_BODY
=
"Click to view"
;
private
static
final
String
PUSH_BODY
=
"Click to view"
;
/**
/**
* 异步系统推送
* 异步系统推送
*
*
* @param imClientReceiver
* @param imClientReceiver
* @param imClientSender
* @param imMessage
*/
*/
@Async
@Async
public
void
push
(
ImClient
imClientReceiver
,
ImClient
imClientSender
,
ImMessage
imMessage
,
ImApplication
imApplication
)
{
public
void
push
(
HashMap
<
String
,
String
>
pushMap
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
log
.
debug
(
"push "
+
imClientReceiver
.
getClientId
());
log
.
debug
(
"push:"
+
imClientReceiver
.
getClientId
());
PushModel
pushModel
=
new
PushModel
();
if
(
pushMap
.
isEmpty
())
{
pushModel
.
setTitle
(
PUSH_TITLE
);
pushModel
.
setSubTitle
(
PUSH_BODY
);
}
else
{
pushModel
.
setTitle
(
pushMap
.
get
(
"title"
));
pushModel
.
setSubTitle
(
pushMap
.
get
(
"subTitle"
));
}
// 校验参数
// 校验参数
if
(
imClientReceiver
.
getValid
()
==
null
||
imClientReceiver
.
getDeviceToken
()
==
null
||
imClientReceiver
.
getDeviceType
()
==
null
)
{
if
(
imClientReceiver
.
getValid
()
==
null
||
imClientReceiver
.
getDeviceToken
()
==
null
||
imClientReceiver
.
getDeviceType
()
==
null
)
{
...
@@ -58,14 +71,14 @@ public class PushTask {
...
@@ -58,14 +71,14 @@ public class PushTask {
// 设备类型1:ios; 2:android
// 设备类型1:ios; 2:android
if
(
imClientReceiver
.
getDeviceType
()
==
1
)
{
if
(
imClientReceiver
.
getDeviceType
()
==
1
)
{
ios
(
imClientReceiver
,
imApplication
);
ios
(
pushModel
,
imClientReceiver
,
imApplication
);
}
else
{
}
else
{
android
(
imClientReceiver
,
imApplication
,
imMessage
);
android
(
pushModel
,
imClientReceiver
,
imApplication
);
}
}
}
}
private
void
android
(
ImClient
imClientReceiver
,
ImApplication
imApplication
,
ImMessage
imMessage
)
{
private
void
android
(
PushModel
pushModel
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
// 安卓推送通道,友盟:1;firebase:2; 信鸽3
// 安卓推送通道,友盟:1;firebase:2; 信鸽3
if
(
imApplication
.
getAndroidPushChannel
()
==
1
)
{
if
(
imApplication
.
getAndroidPushChannel
()
==
1
)
{
log
.
debug
(
"友盟"
);
log
.
debug
(
"友盟"
);
...
@@ -75,10 +88,8 @@ public class PushTask {
...
@@ -75,10 +88,8 @@ public class PushTask {
// 安卓 单推
// 安卓 单推
String
deviceTokenIOS
=
imClientReceiver
.
getDeviceToken
();
String
deviceTokenIOS
=
imClientReceiver
.
getDeviceToken
();
String
titleIOS
=
PUSH_TITLE
;
String
subtitle
=
""
;
try
{
try
{
pushUtils
.
sendIOSUnicast
(
deviceTokenIOS
,
titleIOS
,
subtitle
,
PUSH_BODY
);
pushUtils
.
sendIOSUnicast
(
deviceTokenIOS
,
pushModel
.
getTitle
(),
pushModel
.
getSubTitle
()
,
PUSH_BODY
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -105,9 +116,8 @@ public class PushTask {
...
@@ -105,9 +116,8 @@ public class PushTask {
json
.
put
(
"to"
,
imClientReceiver
.
getDeviceToken
());
json
.
put
(
"to"
,
imClientReceiver
.
getDeviceToken
());
JSONObject
info
=
new
JSONObject
();
JSONObject
info
=
new
JSONObject
();
info
.
put
(
"title"
,
pushModel
.
getTitle
());
info
.
put
(
"title"
,
PUSH_TITLE
);
info
.
put
(
"body"
,
pushModel
.
getSubTitle
());
info
.
put
(
"body"
,
PUSH_BODY
);
//数据消息data 通知消息 notification
//数据消息data 通知消息 notification
json
.
put
(
"notification"
,
info
);
json
.
put
(
"notification"
,
info
);
...
@@ -139,7 +149,7 @@ public class PushTask {
...
@@ -139,7 +149,7 @@ public class PushTask {
}
}
}
}
private
void
ios
(
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
private
void
ios
(
PushModel
pushModel
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
// ios推送通道,友盟:1;firebase:2; apns原生:3
// ios推送通道,友盟:1;firebase:2; apns原生:3
if
(
imApplication
.
getIosPushChannel
()
==
1
)
{
if
(
imApplication
.
getIosPushChannel
()
==
1
)
{
log
.
debug
(
"友盟"
);
log
.
debug
(
"友盟"
);
...
@@ -150,9 +160,9 @@ public class PushTask {
...
@@ -150,9 +160,9 @@ public class PushTask {
// 安卓单推
// 安卓单推
String
deviceToken
=
imClientReceiver
.
getDeviceToken
();
String
deviceToken
=
imClientReceiver
.
getDeviceToken
();
String
unicastText
=
"Android unicast text"
;
String
unicastText
=
"Android unicast text"
;
String
unicastTicker
=
PUSH_BODY
;
String
unicastTicker
=
pushModel
.
getSubTitle
()
;
try
{
try
{
pushUtils
.
sendAndroidUnicast
(
deviceToken
,
unicastText
,
unicastTicker
,
PUSH_TITLE
);
pushUtils
.
sendAndroidUnicast
(
deviceToken
,
unicastText
,
unicastTicker
,
pushModel
.
getTitle
()
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -179,8 +189,8 @@ public class PushTask {
...
@@ -179,8 +189,8 @@ public class PushTask {
//推送到哪台客户端机器
//推送到哪台客户端机器
json
.
put
(
"to"
,
imClientReceiver
.
getDeviceToken
());
json
.
put
(
"to"
,
imClientReceiver
.
getDeviceToken
());
JSONObject
info
=
new
JSONObject
();
JSONObject
info
=
new
JSONObject
();
info
.
put
(
"title"
,
PUSH_TITLE
);
info
.
put
(
"title"
,
pushModel
.
getTitle
()
);
info
.
put
(
"body"
,
PUSH_BODY
);
info
.
put
(
"body"
,
pushModel
.
getSubTitle
()
);
//数据消息data 通知消息 notification
//数据消息data 通知消息 notification
json
.
put
(
"notification"
,
info
);
json
.
put
(
"notification"
,
info
);
...
...
common/src/main/java/com/wecloud/im/ws/strategy/AbstractReceiveStrategy.java
View file @
bac597e0
package
com
.
wecloud
.
im
.
ws
.
strategy
;
package
com
.
wecloud
.
im
.
ws
.
strategy
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.wecloud.im.ws.model.request.ReceiveModel
;
import
com.wecloud.im.ws.model.request.ReceiveModel
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.channel.ChannelHandlerContext
;
...
@@ -19,5 +20,5 @@ public abstract class AbstractReceiveStrategy {
...
@@ -19,5 +20,5 @@ public abstract class AbstractReceiveStrategy {
* @param language
* @param language
* @throws Exception
* @throws Exception
*/
*/
abstract
public
void
process
(
ReceiveModel
requestModel
,
String
language
,
ChannelHandlerContext
ctx
,
String
data
);
abstract
public
void
process
(
ReceiveModel
requestModel
,
String
language
,
ChannelHandlerContext
ctx
,
String
data
)
throws
JsonProcessingException
;
}
}
common/src/main/java/com/wecloud/im/ws/strategy/concrete/ImConcreteReceiveStrategy.java
View file @
bac597e0
...
@@ -45,8 +45,10 @@ import java.util.List;
...
@@ -45,8 +45,10 @@ import java.util.List;
public
class
ImConcreteReceiveStrategy
extends
AbstractReceiveStrategy
{
public
class
ImConcreteReceiveStrategy
extends
AbstractReceiveStrategy
{
private
static
final
String
TO_CONVERSATION_KEY
=
"toConversation"
;
private
static
final
String
TO_CONVERSATION_KEY
=
"toConversation"
;
private
static
final
String
PUSH_KEY
=
"push"
;
private
static
final
String
MSG_ID
=
"msgId"
;
private
static
final
String
MSG_ID
=
"msgId"
;
private
static
final
JsonMapper
JSON_MAPPER
=
new
JsonMapper
();
@Autowired
@Autowired
private
ImClientBlacklistService
imClientBlacklistService
;
private
ImClientBlacklistService
imClientBlacklistService
;
...
@@ -73,7 +75,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -73,7 +75,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
private
PushTask
pushTask
;
private
PushTask
pushTask
;
@Override
@Override
public
void
process
(
ReceiveModel
receiveModel
,
String
language
,
ChannelHandlerContext
ctx
,
String
data
)
{
public
void
process
(
ReceiveModel
receiveModel
,
String
language
,
ChannelHandlerContext
ctx
,
String
data
)
throws
JsonProcessingException
{
String
appKey
=
ctx
.
channel
().
attr
(
MangerChannelService
.
APP_KEY
).
get
();
String
appKey
=
ctx
.
channel
().
attr
(
MangerChannelService
.
APP_KEY
).
get
();
String
clientUniId
=
ctx
.
channel
().
attr
(
MangerChannelService
.
CLIENT_ID
).
get
();
String
clientUniId
=
ctx
.
channel
().
attr
(
MangerChannelService
.
CLIENT_ID
).
get
();
...
@@ -81,7 +83,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -81,7 +83,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
// 查询imApplication
// 查询imApplication
ImApplication
imApplication
=
imApplicationService
.
getOneByAppKey
(
appKey
);
ImApplication
imApplication
=
imApplicationService
.
getOneByAppKey
(
appKey
);
if
(
imApplication
==
null
)
{
if
(
imApplication
==
null
)
{
log
.
error
(
"imApplication为空"
);
log
.
info
(
"imApplication为空"
);
return
;
return
;
}
}
...
@@ -91,21 +93,12 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -91,21 +93,12 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
return
;
return
;
}
}
// 获取会话id
// 获取会话id
if
(
receiveModel
.
getData
().
get
(
TO_CONVERSATION_KEY
)
==
null
)
{
if
(
receiveModel
.
getData
().
get
(
TO_CONVERSATION_KEY
)
==
null
)
{
return
;
return
;
}
}
Long
toConversationId
=
Long
.
valueOf
(
receiveModel
.
getData
().
get
(
TO_CONVERSATION_KEY
).
toString
());
receiveModel
.
getData
().
remove
(
TO_CONVERSATION_KEY
);
String
content
=
null
;
Long
toConversationId
=
Long
.
valueOf
(
receiveModel
.
getData
().
get
(
TO_CONVERSATION_KEY
).
toString
());
JsonMapper
jsonMapper
=
new
JsonMapper
();
try
{
content
=
jsonMapper
.
writeValueAsString
(
receiveModel
.
getData
());
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
// 查询该会话所有成员
// 查询该会话所有成员
List
<
ImConversationMembers
>
membersList
=
imConversationMembersService
.
list
(
List
<
ImConversationMembers
>
membersList
=
imConversationMembersService
.
list
(
...
@@ -113,12 +106,28 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -113,12 +106,28 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
toConversationId
)
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
toConversationId
)
.
notIn
(
ImConversationMembers:
:
getFkClientId
,
imClientSender
.
getId
())
.
notIn
(
ImConversationMembers:
:
getFkClientId
,
imClientSender
.
getId
())
);
);
if
(
membersList
.
isEmpty
())
{
if
(
membersList
.
isEmpty
())
{
log
.
error
(
"membersList为空,toConversationId:"
+
toConversationId
);
log
.
info
(
"membersList为空,toConversationId:"
+
toConversationId
);
return
;
return
;
}
}
receiveModel
.
getData
().
remove
(
TO_CONVERSATION_KEY
);
// 获取自定义推送字段
HashMap
<
String
,
String
>
pushMap
=
null
;
if
(
receiveModel
.
getData
().
get
(
PUSH_KEY
)
!=
null
)
{
pushMap
=
(
HashMap
<
String
,
String
>)
receiveModel
.
getData
().
get
(
PUSH_KEY
);
receiveModel
.
getData
().
remove
(
PUSH_KEY
);
}
String
content
=
null
;
try
{
content
=
JSON_MAPPER
.
writeValueAsString
(
receiveModel
.
getData
());
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
// 判断为单聊
// 判断为单聊
if
(
membersList
.
size
()
==
1
)
{
if
(
membersList
.
size
()
==
1
)
{
// 拉黑逻辑
// 拉黑逻辑
...
@@ -127,7 +136,6 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -127,7 +136,6 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
}
}
}
}
// 生成消息id
// 生成消息id
long
messageId
=
SnowflakeUtil
.
getId
();
long
messageId
=
SnowflakeUtil
.
getId
();
// 保存消息至消息表
// 保存消息至消息表
...
@@ -161,7 +169,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -161,7 +169,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
.
eq
(
ImClient:
:
getId
,
conversationMembers
.
getFkClientId
()));
.
eq
(
ImClient:
:
getId
,
conversationMembers
.
getFkClientId
()));
if
(
imClientReceiver
==
null
)
{
if
(
imClientReceiver
==
null
)
{
return
;
continue
;
}
}
// 向接收方推送
// 向接收方推送
...
@@ -175,7 +183,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -175,7 +183,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
writeDataService
.
write
(
responseModel
,
appKey
,
imClientReceiver
.
getClientId
());
writeDataService
.
write
(
responseModel
,
appKey
,
imClientReceiver
.
getClientId
());
// 异步推送系统通知消息
// 异步推送系统通知消息
pushTask
.
push
(
imClientReceiver
,
imClientSender
,
imMessage
,
imApplication
);
pushTask
.
push
(
pushMap
,
imClientReceiver
,
imApplication
);
}
}
// 响应发送方消息id等信息
// 响应发送方消息id等信息
...
@@ -197,7 +205,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -197,7 +205,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
.
eq
(
ImClient:
:
getClientId
,
clientUniId
));
.
eq
(
ImClient:
:
getClientId
,
clientUniId
));
if
(
imClientSender
==
null
)
{
if
(
imClientSender
==
null
)
{
log
.
error
(
"imClientSender为空"
);
log
.
info
(
"imClientSender为空"
);
return
null
;
return
null
;
}
}
return
imClientSender
;
return
imClientSender
;
...
@@ -223,7 +231,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -223,7 +231,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
// 判断是否被拉黑
// 判断是否被拉黑
boolean
beBlack
=
imClientBlacklistService
.
isBeBlack
(
membersList
.
get
(
0
).
getFkClientId
(),
imClientSender
.
getId
());
boolean
beBlack
=
imClientBlacklistService
.
isBeBlack
(
membersList
.
get
(
0
).
getFkClientId
(),
imClientSender
.
getId
());
if
(
beBlack
)
{
if
(
beBlack
)
{
log
.
debug
(
"被对方拉黑了"
);
log
.
info
(
"被对方拉黑了"
);
// 响应发送方
// 响应发送方
ResponseModel
<
HashMap
<
String
,
Long
>>
responseModel
=
new
ResponseModel
<>();
ResponseModel
<
HashMap
<
String
,
Long
>>
responseModel
=
new
ResponseModel
<>();
...
@@ -239,7 +247,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
...
@@ -239,7 +247,7 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
// 是否把对方拉黑
// 是否把对方拉黑
boolean
black
=
imClientBlacklistService
.
isBeBlack
(
imClientSender
.
getId
(),
membersList
.
get
(
0
).
getFkClientId
());
boolean
black
=
imClientBlacklistService
.
isBeBlack
(
imClientSender
.
getId
(),
membersList
.
get
(
0
).
getFkClientId
());
if
(
black
)
{
if
(
black
)
{
log
.
debug
(
"你把对方拉黑了"
);
log
.
info
(
"你把对方拉黑了"
);
// 响应发送方
// 响应发送方
ResponseModel
<
HashMap
<
String
,
Long
>>
responseModel
=
new
ResponseModel
<>();
ResponseModel
<
HashMap
<
String
,
Long
>>
responseModel
=
new
ResponseModel
<>();
ApiResult
<
Boolean
>
result
=
ApiResult
.
result
(
ApiCode
.
IS_TO_BLACK
);
ApiResult
<
Boolean
>
result
=
ApiResult
.
result
(
ApiCode
.
IS_TO_BLACK
);
...
...
common/src/main/resources/mapper/ImMessageMapper.xml
View file @
bac597e0
...
@@ -32,7 +32,8 @@
...
@@ -32,7 +32,8 @@
im_message.system,
im_message.system,
im_message.`at`,
im_message.`at`,
im_message.send_status,
im_message.send_status,
im_message.fk_conversation_id
im_message.fk_conversation_id,
(SELECT COUNT(id) FROM im_inbox WHERE fk_msg_id = msgId AND read_msg_status = 0) AS not_read_count
FROM im_inbox
FROM im_inbox
INNER JOIN im_message im_message ON im_message.id = im_inbox.fk_msg_id
INNER JOIN im_message im_message ON im_message.id = im_inbox.fk_msg_id
INNER JOIN `im_client` ON `im_client`.id = `im_message`.sender
INNER JOIN `im_client` ON `im_client`.id = `im_message`.sender
...
...
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