Commit 82f96153 by hweeeeeei

允许客户端自定义系统推送内容,消息model-push中添加"data"参数为自定义数据,可以为json或字符串

parent 6fdcff36
...@@ -223,7 +223,7 @@ public class PushTask { ...@@ -223,7 +223,7 @@ public class PushTask {
// 自定义推送字段 // 自定义推送字段
Map<String, String> dataMap = new HashMap<>(); Map<String, String> dataMap = new HashMap<>();
dataMap.put("data", pushModel.getData()); dataMap.put("data", pushModel.getData());
info.put("data", dataMap); json.put("data", dataMap);
//数据消息data 通知消息 notification //数据消息data 通知消息 notification
json.put("notification", info); json.put("notification", info);
...@@ -232,6 +232,9 @@ public class PushTask { ...@@ -232,6 +232,9 @@ public class PushTask {
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
jsonStr = json.toString(); jsonStr = json.toString();
log.info("FCM push data {}", jsonStr);
wr.write(jsonStr); wr.write(jsonStr);
wr.flush(); wr.flush();
InputStream inputStream = conn.getInputStream(); InputStream inputStream = conn.getInputStream();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment