Quellcode durchsuchen

老师课酬特殊提示音推送

zouxuan vor 4 Jahren
Ursprung
Commit
55513a1965

+ 8 - 4
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/JiguangPushPlugin.java

@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -76,10 +77,14 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 		JSONObject android = new JSONObject();// android通知内容
 		android.put("alert", alert);
 		android.put("sound", sound.split("\\.")[0]);
+		JSONObject options = new JSONObject();// 设置参数
 		if(StringUtils.isNotEmpty(channelId)){
-			StringBuffer sb = new StringBuffer("{\"xiaomi\":{\"distribution\":\"secondary_push\",\"channel_id\":\"");
-			sb.append(channelId).append("\"}}");
-			android.put("third_party_channel", sb.toString());
+			JSONObject thirdParty = new JSONObject();
+			JSONObject xiaomi = new JSONObject();
+			xiaomi.put("distribution","secondary_push");
+			xiaomi.put("channel_id",channelId);
+			thirdParty.put("xiaomi",xiaomi);
+			options.put("third_party_channel",thirdParty);
 		}
 		android.put("builder_id", 1);
 		JSONObject android_extras = new JSONObject();// android额外参数
@@ -105,7 +110,6 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 		message.put("msg_content", content);
 		message.put("content_type","text");
 
-		JSONObject options = new JSONObject();// 设置参数
 		options.put("time_to_live", this.time_to_live);
 		options.put("apns_production", this.apns_production);