admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java
@@ -88,6 +88,16 @@
         json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.ZNX) {
         json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
      } else if (type == PushController.WEEX) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            throw new Exception("获取短链出错");
         json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.BAICHUAN) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            throw new Exception("获取短链出错");
         json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
      }
      // 分组推送 每50个设备为一组
@@ -138,10 +148,12 @@
      PushNotificationManager pushManager = new PushNotificationManager();
      // true:表示的是产品线上发布推送服务 false:表示的是产品测试推送服务
      if(Constant.IS_TEST)
         pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePassword, false));
      if (Constant.IS_TEST)
         pushManager.initializeConnection(
               new AppleNotificationServerBasicImpl(certificate, certificatePassword, false));
      else
         pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePassword, true));
         pushManager
               .initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePassword, true));
      List<Device> deviceList = new ArrayList<Device>();
      for (String token : tokenList) {
@@ -196,19 +208,18 @@
         return 4;
      }
   }
   /**
    * 执行推送
    *
    * @param tokenList
    * @param json
    * @throws Exception
    */
   public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception{
   public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception {
      pushIOS(tokenList, json);
   }
   /**
    * 
    * 方法说明: IOS 多推
@@ -220,8 +231,7 @@
    * @return
    * @throws Exception
    */
   public static JSONObject getJSONObject(MessageInfo info, String url, int type)
         throws Exception {
   public static JSONObject getJSONObject(MessageInfo info, String url, int type) throws Exception {
      // json自定义传值
      JSONObject json = null;
@@ -245,6 +255,16 @@
         json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.ZNX) {
         json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
      } else if (type == PushController.WEEX) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            shortUrl = url;
         json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.BAICHUAN) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            shortUrl = url;
         json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
      }
      return json;