admin
2018-12-10 01d627f3c67e2bc5c28b2dd5e23983ddcf7a08f3
fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java
@@ -16,7 +16,6 @@
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.push.DeviceTokenIOS;
import com.yeshi.fanli.entity.push.PushGoods;
import com.yeshi.fanli.entity.push.PushGoodsGroup;
import com.yeshi.fanli.entity.push.PushGoodsRecord;
@@ -111,16 +110,10 @@
         da.setDeviceToken(deviceToken);
         da.setPlatform(DeviceActive.PLATFORM_IOS);
         da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
         da.setDevice(acceptData.getDevice());
         deviceActiveService.addDeviceActive(da);
         DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
         if (deviceTokenIOS == null)
            iosPushService.addDeviceToken(null, Integer.parseInt(acceptData.getVersion()), deviceToken,
                  acceptData.getDevice());
         else {
            deviceTokenIOS.setDevice(acceptData.getDevice());
            iosPushService.updateDeviceToken(deviceTokenIOS);
         }
         out.print(JsonUtil.loadTrue(0, null, "成功"));
      }
   }
@@ -141,19 +134,11 @@
         da.setDeviceToken(deviceToken);
         da.setPlatform(DeviceActive.PLATFORM_IOS);
         da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
         da.setDevice(acceptData.getDevice());
         deviceActiveService.addDeviceActive(da);
         // 添加token
         DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
         if (deviceTokenIOS != null) {
            deviceTokenIOS.setUid(uid);
            deviceTokenIOS.setDevice(acceptData.getDevice());
            deviceTokenIOS.setVersion(Integer.parseInt(acceptData.getVersion()));
            iosPushService.updateDeviceToken(deviceTokenIOS);
         } else {
            iosPushService.addDeviceToken(uid, Integer.parseInt(acceptData.getVersion()), deviceToken,
                  acceptData.getDevice());
         }
         out.print(JsonUtil.loadTrueResult(""));
      }
   }
@@ -165,12 +150,8 @@
    */
   @RequestMapping(value = "/unBind", method = RequestMethod.POST)
   public void unBind(AcceptData acceptData, String deviceToken, PrintWriter out) {
      if (!StringUtil.isNullOrEmpty(deviceToken)) {
         DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
         if (deviceTokenIOS != null) {
            deviceTokenIOS.setUid(null);
            iosPushService.updateDeviceToken(deviceTokenIOS);
         }
      if (!StringUtil.isNullOrEmpty(acceptData.getDevice())) {
         iosPushService.unBindUidAndDevice(acceptData.getDevice());
         out.print(JsonUtil.loadTrue(0, null, "解绑成功"));
      }
   }
@@ -202,7 +183,6 @@
      deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
      out.print(JsonUtil.loadTrueResult("成功"));
   }
   
   /**
    * 解绑推送
@@ -273,7 +253,6 @@
               String fontColor2 = "#E5005C";
               JSONArray array = new JSONArray();
               
               JSONObject contentJson1 = new JSONObject();
               contentJson1.put("color", fontColor1);
               contentJson1.put("content", "本次推荐共");
@@ -339,8 +318,8 @@
                  Long deviceId = deviceActive.getId();
                  for (PushGoods pushGoods : listPush) {
                     List<PushGoodsRecord> listRecord = pushGoodsRecordService.listByPushIdAndDeviceId(
                           pushGoods.getId(), deviceId);
                     List<PushGoodsRecord> listRecord = pushGoodsRecordService
                           .listByPushIdAndDeviceId(pushGoods.getId(), deviceId);
                     if (listRecord != null && listRecord.size() > 0) {
                        continue; // 已被记录
                     }