Commit 11e4a8ef by hweeeeeei

Merge branch 'feature-1.4-pushParam' of…

Merge branch 'feature-1.4-pushParam' of https://gitlab.aillo.cc/hewei/wecloud_im_server into feiwa_test
parents 8d6206ae 78ffad7a
package com.wecloud.im.ws.sender; package com.wecloud.im.ws.sender;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.json.JsonMapper;
import com.turo.pushy.apns.DeliveryPriority; import com.turo.pushy.apns.DeliveryPriority;
import com.turo.pushy.apns.PushType; import com.turo.pushy.apns.PushType;
...@@ -106,7 +105,7 @@ public class PushTask { ...@@ -106,7 +105,7 @@ public class PushTask {
* @param imClientReceiver * @param imClientReceiver
*/ */
@Async @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()); log.info("push:" + imClientReceiver.getClientId());
PushModel pushModel = getPushModel(pushMap); PushModel pushModel = getPushModel(pushMap);
...@@ -115,24 +114,24 @@ public class PushTask { ...@@ -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(); PushModel pushModel = new PushModel();
if (pushMap == null || pushMap.isEmpty()) { if (pushMap == null || pushMap.isEmpty()) {
pushModel.setTitle(PUSH_TITLE); pushModel.setTitle(PUSH_TITLE);
pushModel.setSubTitle(PUSH_BODY); pushModel.setSubTitle(PUSH_BODY);
pushModel.setData(new HashMap<>(1)); pushModel.setData(new HashMap<>(1));
} else { } else {
pushModel.setTitle(pushMap.get(title)); pushModel.setTitle((String) pushMap.get(title));
pushModel.setSubTitle(pushMap.get(subTitle)); pushModel.setSubTitle((String) pushMap.get(subTitle));
// 自定义推送内容 // 自定义推送内容
try { // try {
HashMap hashMap = JSON_MAPPER.readValue(pushMap.get(DATA), HashMap.class); HashMap hashMap = (HashMap) pushMap.get(DATA);
pushModel.setData(hashMap); pushModel.setData(hashMap);
} catch (JsonProcessingException e) { // } catch (JsonProcessingException e) {
log.error("pushModel.setData(hashMap)", e); // log.error("pushModel.setData(hashMap)", e);
pushModel.setData(new HashMap<>(1)); // pushModel.setData(new HashMap<>(1));
} // }
} }
return pushModel; return pushModel;
......
...@@ -112,9 +112,9 @@ public class ImChatConcrete extends ImCmdAbstract { ...@@ -112,9 +112,9 @@ public class ImChatConcrete extends ImCmdAbstract {
receiveModel.getData().remove(TO_CONVERSATION_KEY); receiveModel.getData().remove(TO_CONVERSATION_KEY);
// 获取自定义推送字段 // 获取自定义推送字段
HashMap<String, String> pushMap = null; HashMap<String, Object> pushMap = null;
if (receiveModel.getData().get(PUSH_KEY) != 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); receiveModel.getData().remove(PUSH_KEY);
} }
......
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