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
78ffad7a
Commit
78ffad7a
authored
Jan 12, 2022
by
hweeeeeei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复push的字段报错, 原因:传入json中是一个object
parent
2e327296
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
+11
-12
common/src/main/java/com/wecloud/im/ws/strategy/concrete/ImChatConcrete.java
+2
-2
No files found.
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
View file @
78ffad7a
package
com
.
wecloud
.
im
.
ws
.
sender
;
import
cn.hutool.core.codec.Base64
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.json.JsonMapper
;
import
com.turo.pushy.apns.DeliveryPriority
;
import
com.turo.pushy.apns.PushType
;
...
...
@@ -106,7 +105,7 @@ public class PushTask {
* @param imClientReceiver
*/
@Async
public
void
push
(
HashMap
<
String
,
String
>
pushMap
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
public
void
push
(
HashMap
<
String
,
Object
>
pushMap
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
log
.
info
(
"push:"
+
imClientReceiver
.
getClientId
());
PushModel
pushModel
=
getPushModel
(
pushMap
);
...
...
@@ -115,24 +114,24 @@ public class PushTask {
}
private
PushModel
getPushModel
(
HashMap
<
String
,
String
>
pushMap
)
{
private
PushModel
getPushModel
(
HashMap
<
String
,
Object
>
pushMap
)
{
PushModel
pushModel
=
new
PushModel
();
if
(
pushMap
==
null
||
pushMap
.
isEmpty
())
{
pushModel
.
setTitle
(
PUSH_TITLE
);
pushModel
.
setSubTitle
(
PUSH_BODY
);
pushModel
.
setData
(
new
HashMap
<>(
1
));
}
else
{
pushModel
.
setTitle
(
pushMap
.
get
(
title
));
pushModel
.
setSubTitle
(
pushMap
.
get
(
subTitle
));
pushModel
.
setTitle
(
(
String
)
pushMap
.
get
(
title
));
pushModel
.
setSubTitle
(
(
String
)
pushMap
.
get
(
subTitle
));
// 自定义推送内容
try
{
HashMap
hashMap
=
JSON_MAPPER
.
readValue
(
pushMap
.
get
(
DATA
),
HashMap
.
class
);
pushModel
.
setData
(
hashMap
);
}
catch
(
JsonProcessingException
e
)
{
log
.
error
(
"pushModel.setData(hashMap)"
,
e
);
pushModel
.
setData
(
new
HashMap
<>(
1
));
}
//
try {
HashMap
hashMap
=
(
HashMap
)
pushMap
.
get
(
DATA
);
pushModel
.
setData
(
hashMap
);
//
} catch (JsonProcessingException e) {
//
log.error("pushModel.setData(hashMap)", e);
//
pushModel.setData(new HashMap<>(1));
//
}
}
return
pushModel
;
...
...
common/src/main/java/com/wecloud/im/ws/strategy/concrete/ImChatConcrete.java
View file @
78ffad7a
...
...
@@ -112,9 +112,9 @@ public class ImChatConcrete extends ImCmdAbstract {
receiveModel
.
getData
().
remove
(
TO_CONVERSATION_KEY
);
// 获取自定义推送字段
HashMap
<
String
,
String
>
pushMap
=
null
;
HashMap
<
String
,
Object
>
pushMap
=
null
;
if
(
receiveModel
.
getData
().
get
(
PUSH_KEY
)
!=
null
)
{
pushMap
=
(
HashMap
<
String
,
String
>)
receiveModel
.
getData
().
get
(
PUSH_KEY
);
pushMap
=
(
HashMap
<
String
,
Object
>)
receiveModel
.
getData
().
get
(
PUSH_KEY
);
receiveModel
.
getData
().
remove
(
PUSH_KEY
);
}
...
...
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