Bladeren bron

激光消息推送

liujc 1 jaar geleden
bovenliggende
commit
0d847a54bd

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

@@ -59,7 +59,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
      * @param content 消息内容
      * @return json对象
      */
-    private JSONObject generateJson(String[] alias, String alert, String content, String url, String sound, String channelId, JSONObject androidIntent) {
+    private JSONObject generateJson(String[] alias, String alert, String content, String url, String sound, String channelId, JSONObject androidIntent,String type) {
         JSONObject json = new JSONObject();
         JSONArray platform = new JSONArray();// 平台
         platform.add("android");
@@ -90,6 +90,9 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
         android_extras.put("type", "infomation");
         android_extras.put("url", url);
         android_extras.put("memo", url);
+        if (StringUtils.isNotEmpty(type) && type.equals("SCHOOL")) {
+            android_extras.put("clientType", type);
+        }
         //2022年6月22日 增加 third_url_encode 参数,极光推送数据中带有#号需要转译
         android_extras.put("third_url_encode", true);
         android.put("extras", android_extras);
@@ -104,6 +107,9 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
         ios_extras.put("type", "infomation");
         ios_extras.put("url", url);
         ios_extras.put("memo", url);
+        if (StringUtils.isNotEmpty(type) && type.equals("SCHOOL")) {
+            ios_extras.put("clientType", type);
+        }
         ios.put("extras", ios_extras);
         notification.put("android", android);
         notification.put("ios", ios);
@@ -155,7 +161,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
                 break;
         }
         String authorization = "Basic " + base64_auth_string;
-        JSONObject jsonObject = generateJson(alias, alert, content, url, sound, channelId, androidIntent);
+        JSONObject jsonObject = generateJson(alias, alert, content, url, sound, channelId, androidIntent,type);
         return sendPostRequest(jsonObject.toString(), authorization);
     }