admin
2019-02-28 4e938ce8cf18ebb12c102e7c18c1ca16fe1b15a8
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -219,9 +219,31 @@
         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));
         data.put("totalCount", totalCount > 99 ? "99+" : totalCount);
      } else {
         data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
         data.put("totalCount", totalCount);
      }
      try {
         UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);