admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java
@@ -12,6 +12,7 @@
import com.google.gson.Gson;
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.xinge.MessageInfo;
import com.yeshi.fanli.entity.xinge.PushRecord;
import com.yeshi.fanli.log.LogHelper;
@@ -57,8 +58,8 @@
   public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type)
         throws Exception {
      if (Constant.IS_TEST)
         return null;
      // if (Constant.IS_TEST)
      // return null;
      Gson gson = new Gson();
      PushLogHelper.iosInfo("IOS推送设备数为:" + deviceTokenList.size());
@@ -70,7 +71,7 @@
      // json自定义传值
      JSONObject json = null;
      if (type == PushController.GOODS) {
      if (type == PushTypeEnum.goodsdetail.getCode()) {
         Long auctionId = null;
         if (url.contains("id=")) {
            String[] sts = url.split("\\?")[1].split("&");
@@ -83,26 +84,30 @@
         if (auctionId == null)
            throw new Exception("淘宝商品ID提取出错");
         json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
      } else if (type == PushController.URL) {
      } else if (type == PushTypeEnum.url.getCode()) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            throw new Exception("获取短链出错");
         json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.ZNX) {
      } else if (type == PushTypeEnum.ZNX.getCode()) {
         json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
      } else if (type == PushController.WEEX) {
      } else if (type == PushTypeEnum.weex.getCode()) {
         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("获取短链出错");
      } else if (type == PushTypeEnum.baichuan.getCode()) {
         String shortUrl = url;
         // HttpUtil.getShortLink(url);
         // if (StringUtil.isNullOrEmpty(shortUrl))
         // throw new Exception("获取短链出错");
         json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.WELFARE_CENTER) {
      } else if (type == PushTypeEnum.welfare.getCode()) {
         json = IOSPushFactory.createWelfarePush(info.getTitle(), info.getContent());
      } else if (type == PushTypeEnum.signin.getCode()) {
         json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
      }
      // 分组推送 每50个设备为一组
      InputStream certificate = IOSPushUtil.class.getClassLoader()
@@ -241,7 +246,7 @@
      // json自定义传值
      JSONObject json = null;
      if (type == PushController.GOODS) {
      if (type == PushTypeEnum.goodsdetail.getCode()) {
         Long auctionId = null;
         if (url.contains("id=")) {
            String[] sts = url.split("\\?")[1].split("&");
@@ -254,23 +259,25 @@
         if (auctionId == null)
            throw new Exception("淘宝商品ID提取出错");
         json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
      } else if (type == PushController.URL) {
      } else if (type == PushTypeEnum.url.getCode()) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            throw new Exception("获取短链出错");
         json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.ZNX) {
      } else if (type == PushTypeEnum.ZNX.getCode()) {
         json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
      } else if (type == PushController.WEEX) {
      } else if (type == PushTypeEnum.weex.getCode()) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            shortUrl = url;
         json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushController.BAICHUAN) {
      } else if (type == PushTypeEnum.baichuan.getCode()) {
         String shortUrl = HttpUtil.getShortLink(url);
         if (StringUtil.isNullOrEmpty(shortUrl))
            shortUrl = url;
         json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
      } else if (type == PushTypeEnum.signin.getCode()) {
         json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
      }
      return json;