admin
2019-02-28 f51cf41d12635b59c2d6ee33685e82fe3d5751b3
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -219,9 +219,30 @@
         return;
      }
      UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
      JSONObject data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
      data.put("totalCount", num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem()+num.getTypeOther());
      GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
            new JsonSerializer<Integer>() {
               @Override
               public JsonElement serialize(Integer value, Type theType, JsonSerializationContext context) {
                  if (value == null) {
                     return new JsonPrimitive("0");
                  } else {
                     if (value >= 100)
                        return new JsonPrimitive("99+");
                     else
                        return new JsonPrimitive(value);
                  }
               }
            });
      int totalCount = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
      JSONObject data = null;
      if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
         data = JSONObject.fromObject(androidBuilder.excludeFieldsWithoutExposeAnnotation().create().toJson(num));
      } else {
         data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
      }
      data.put("totalCount", totalCount);
      try {
         UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
@@ -550,7 +571,7 @@
      UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
      int totalNum = num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
            + num.getTypeScore() + num.getTypeSystem();
            + num.getTypeScore() + num.getTypeSystem() + num.getTypeOther();
      if (totalNum == 0) {
         out.print(JsonUtil.loadFalseResult(1, "没有未读消息"));
         return;