code: public void queryMessages(final AVIMMessageInterval interval, AVIMMessageQueryDirection direction, final int limit,
                              final AVIMMessagesQueryCallback callback) {
      if (null == interval || limit < 0) {
        if (null != callback) {
          callback.internalDone(null,
                  new AVException(new IllegalArgumentException("interval must not null, or limit must great than 0.")));
        }
        return;
      }
      String mid = null;
      long ts = 0;
      boolean startClosed = false;
      String tmid = null;
      long tts = 0;
      boolean endClosed = false;
      if (null != interval.startIntervalBound) {
        mid = interval.startIntervalBound.messageId;
        ts = interval.startIntervalBound.timestamp;
        startClosed = interval.startIntervalBound.closed;
      }
      if (null != interval.endIntervalBound) {
        tmid = interval.endIntervalBound.messageId;
        tts = interval.endIntervalBound.timestamp;
        endClosed = interval.endIntervalBound.closed;
      }
      queryMessagesFromServer(mid, ts, startClosed, tmid, tts, endClosed, direction, limit, callback);
    }
docs: 根据指定的区间来查询历史消息，可以指定区间开闭、查询方向以及最大条目限制
  @param interval  - 区间，由起止 AVIMMessageIntervalBound 组成
  @param direction - 查询方向，支持向前（AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromNewToOld）
  或向后（AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromOldToNew）查询
  @param limit     - 结果最大条目限制
  @param callback  - 结果回调函数