得到批量查询的卡券(获取卡券列表)
@param int $offset 起始偏移量
@param int $count 需要查询的卡片的数量(数量最大 50)
@return bool
@throws HttpException
762253
public function getBatchCards($offset = 0, $count = 50)
    {
        $result = $this->httpPost(static::WECHAT_GET_BATCH_CARD_URL . 'access_token=' . $this->getAccessToken(), [
            'offset' => $offset,
            'count' => $count
        ]);

        return isset($result['card_id_list']) ? $result['card_id_list'] : false;
    }
743660
public function get($table, $where = array(), $offset = null, $count = null, $time = null, $order = array(), $od = "ValidFrom", $do = "ValidUntil", $id2 = "ID", $cols = array(), $groupby = array(), $having = array(), $distinct = false, $fast = false) {
        $data = array("QueryBuilder" => array("Where" => $where, "Offset" => $offset, "Limit" => $count, "Time" => $time, "Sort" => $order, "Cols" => $cols, "GroupBy" => $groupby, "Having" => $having, "Distinct" => $distinct));
        $data["ApiKeySession"] = $this->Session;
        $data["CRC"] = Client::MakeCRC($data, $this->ApiPass);
        try {
            $results = Client::Call($this->Server . "/" . $table . "/Request", $data);
            return new APIResult($results);
        }
        catch(\Exception $exc) {
            $this->lastError = $exc->getMessage();
            if (self::$DEBUG_CRC) {
                if (strpos($this->lastError, "CRC does not match")) {
                    $add = "Request failed! Client data: ";
                    $add.= \AsyncWeb\Api\REST\Client::MakeHashString($data);
                    $add.= " CRC: " . Client::MakeCRC($data, $this->ApiPass);
                    $this->lastError.= "<br>\n" . $add;
                }
            }
            return false;
        }
    }
143734
function slice ($offset = 0, $count = -1)
  {
    $this->setIterator (new LimitIterator ($this->getIterator (), $offset, $count));
    return $this;
  }
133160
public function lists($offset = 0, $count = 10, $statusList = array())
    {
        $params = array(
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        );

        $result = $this->http->jsonPost(self::API_LIST, $params);

        return $result['card_id_list'];
    }
289939
private function read($count) {
        $count = abs($count);

        if ($count > 0) {
            return fread($this->STREAM, $count);
        }

        return NULL;
    }
1330227
public function offset($count)
    {
        if (count($this->models) < $count) {
            return $this->models[$count];
        }
        return null;
    }
1204635
public static function calculateOffset($count, $limit, $comment = null) {

		$order = self::getCommentsSort();
		$style = self::getLoadStyle();

		if ($comment instanceof Comment) {
			$thread = new Thread($comment);
			$offset = $thread->getOffset($limit, $order);
		} else if (($order == 'time_created::asc' && $style == 'load_older') || ($order == 'time_created::desc' && $style == 'load_newer')) {
			// show last page
			$offset = $count - $limit;
			if ($offset < 0) {
				$offset = 0;
			}
		} else {
			// show first page
			$offset = 0;
		}

		return (int) $offset;
	}
898010
public function read(int $count): string
    {
        $data = $this->doRead($this->offset, $count);
        $this->offset += $count;
        return $data;
    }
1098709
public function hasExactCountOfObjects($count): bool
    {
        $this->collectObjects(true);

        return $this->getCountOfObjectsInCollection() === (int)$count;
    }
821165
public function setLimit($count, $offset = null)
    {
        $this->_dsql()->limit($count, $offset);

        return $this;
    }
436001
public function ezCount($stat, $count = 1)
    {
        if (! isset($this->config['ez_key'])) {
            throw new Exception('StatHat EZ key not set.');
        }

        // If a prefix is set, prepend it to the stat name.
        if (! empty($this->config['prefix'])) {
            $stat = $this->config['prefix'].$stat;
        }

        $this->post('ez', ['ezkey' => $this->config['ez_key'], 'stat' => $stat, 'count' => $count]);
    }
468490
public function getMaxColumn($offset, $count)
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/cells?offset=' .
            $offset . '&count=' . $count;
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        return $json->Cells->MaxColumn;

    }
853812
public function read($count)
    {
        $contentLength = strlen($this->data);
        if ($this->position > $contentLength || $count > $contentLength - $this->position) {
            throw new EndOfStreamException(
                sprintf(
                    'End of stream reached when trying to read %d bytes. content length=%d, position=%d',
                    $count,
                    $contentLength,
                    $this->position
                )
            );
        }

        $chunk = substr($this->data, $this->position, $count);
        if ($chunk === false) {
            $chunk = '';
        }

        $readBytes = strlen($chunk);
        $this->position += $readBytes;

        return $chunk;
    }
528597
public function hit(Endpoint $endpoint, $count = 1)
    {
        $region = $endpoint->getRegion();
        $limitsForRegion = $this->limits->getLimitsForRegion($region);
        
        foreach ($limitsForRegion as $time => $limit) {
            // Get the respective time limit for this region
            $item = $this->get($region, $time);
            
            // No results found, create new count for the limit
            if (! $item->isHit()) {
                $item->set($count)->expiresAfter($time);
                $this->store->save($item);
                continue;
            }
            
            // Otherwise there is a count saved for the region,
            // check if the request count can be performed.
            $currentCount = $item->get();
            if ($count + $currentCount > $limit) {
                $message = "Sending {$count} request".($count === 1 ? '' : 's')." is not allowed! ".
                    "Rate limit for '{$region->getName()}' reached. Current count: {$currentCount}. Limits:".
                    array_reduce(array_keys($limitsForRegion), function ($str, $time) use ($limitsForRegion) {
                        return "{$str} {$limitsForRegion[$time]}/{$time}s";
                    }, '');
                throw new RateLimitReachedException($message);
            }
            
            // If it can, increase the current limit
            $item->set($currentCount + $count);
            $this->store->save($item);
        }
        
        return true;
    }
1104609
public function batchGet($offset, $count = 50, array $status_list = [])
    {
        $data = ['offset' => $offset, 'count' => $count];
        empty($status_list) || $data['status_list'] = $status_list;
        $url = "https://api.weixin.qq.com/card/batchget?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
138686
public function limit($sql, $count, $offset = 0)
     {
        $count = intval($count);
        if ($count <= 0) {
            // require_once 'Zend/Db/Adapter/Exception.php';
            throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
        }

        $offset = intval($offset);
        if ($offset < 0) {
            /** @see Zend_Db_Adapter_Exception */
            // require_once 'Zend/Db/Adapter/Exception.php';
            throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
        }

        if ($offset == 0) {
            $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql);
        } else {
            $orderby = stristr($sql, 'ORDER BY');

            if (!$orderby) {
                $over = 'ORDER BY (SELECT 0)';
            } else {
                $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);
            }

            // Remove ORDER BY clause from $sql
            $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql);

            // Add ORDER BY clause as an argument for ROW_NUMBER()
            $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl";

            $start = $offset + 1;
            $end = $offset + $count;

            $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end";
        }

        return $sql;
    }
1367452
public function responseIsSuccessfullyWithContainListResult(TableNode $table, $count = null)
    {
        $this->responseIsSuccessfully();

        $rpcResult = $this->response->getRpcResult();

        Assertions::assertTrue(is_array($rpcResult), sprintf(
            'The RPC response must be a array, but "%s" given.',
            gettype($rpcResult)
        ));

        if ($count !== null) {
            Assertions::assertCount((int) $count, $rpcResult, sprintf(
                'The response should have %d elements, but %d given.',
                $count,
                count($rpcResult)
            ));
        }

        foreach($table->getHash() as $key => $row) {
            if (isset($row['__key__'])) {
                $key = $row['__key__'];
                unset ($row['__key__']);
            }

            Assertions::assertArrayHasKey($key, $rpcResult, sprintf(
                'Not found data with key "%s" in array (%s).',
                $key,
                json_encode($rpcResult)
            ));

            $this->assertArrayEquals($rpcResult[$key], $row);
        }
    }