获取小程序模板库标题列表
@since 2.8.18
@param access_token access_token
@param offset offset和count用于分页，表示从offset开始，拉取count条记录，offset从0开始，count最大为20。
@param count offset和count用于分页，表示从offset开始，拉取count条记录，offset从0开始，count最大为20。
@return result
165982
public static TemplateLibraryListResult templateLibraryList(String access_token,int offset,int count){
		String json = String.format("{\"offset\":%d,\"count\":%d}", offset, count);
		HttpUriRequest httpUriRequest = RequestBuilder.post()
				.setHeader(jsonHeader)
				.setUri(BASE_URI+"/cgi-bin/wxopen/template/library/list")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
				.setEntity(new StringEntity(json,Charset.forName("utf-8")))
				.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,TemplateLibraryListResult.class);
	}
1365105
public static <E> Page<E> offsetPage(int offset, int limit, boolean count) {
        Page<E> page = new Page<E>(new int[]{offset, limit}, count);
        //当已经执行过orderBy的时候
        Page<E> oldPage = getLocalPage();
        if (oldPage != null && oldPage.isOrderByOnly()) {
            page.setOrderBy(oldPage.getOrderBy());
        }
        setLocalPage(page);
        return page;
    }
1206905
public static BaseResult groupsMembersUpdate(String access_token,String openid,String to_groupid){
		String groupJson = "{\"openid\":\""+openid+"\",\"to_groupid\":"+to_groupid+"}";
		HttpUriRequest httpUriRequest = RequestBuilder.post()
										.setHeader(jsonHeader)
										.setUri(BASE_URI+"/cgi-bin/groups/members/update")
										.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
										.setEntity(new StringEntity(groupJson,Charset.forName("utf-8")))
										.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
	}
395988
public function batchGetCardLocation($offset = 0, $count = 0)
    {
        return $this->auth(function () use ($offset, $count) {
            $data = json_encode(['offset' => $offset, 'count' => $count], JSON_UNESCAPED_UNICODE);
            $result = $this->http->postJson(
                $this->baseUrl . 'card/location/batchget?access_token=' . $this->accessToken,
                $data
            );

            return $result;
        });
    }
771213
function _numberToKey(index, totalChar, offset) {
    var aArr = [],
      currentChar = index;
    totalChar = totalChar || 26;
    offset = offset || 65;
    while (currentChar >= totalChar) {
      aArr.push((currentChar % totalChar) + offset);
      currentChar = Math.floor(currentChar / totalChar - 1);
    }
    aArr.push(currentChar + offset);
    return aArr.reverse();
  }
1229260
public int peek(int offset) throws IOException {
        if(this.count < 0) {
            return EOF;
        }

        if(offset < 0) {
            throw new java.lang.IllegalArgumentException("offset must be >= 0");
        }

        /**
         * 实际请求位置
         */
        int i = this.index + offset;

        if(i < this.count) {
            return this.buffer[i];
        }

        /**
         * �?��读取新数�?         * 先将旧的数据移动到buffer的起始位�?         */
        if(this.index > 0) {
            if(this.count - this.index > 0) {
                System.arraycopy(this.buffer, this.index, this.buffer, 0, this.count - this.index);
            }
            this.count = this.count - this.index;
            this.index = 0;
        }

        /**
         * 如果请求位置超出了buffer容量
         */
        if(offset > this.buffer.length) {
            /**
             * 扩容, 确保容量超过请求位置
             * 新的容量大小是当前bufferSize的�?�?             */
            int bufferSize = (offset / this.buffer.length + 1) * this.buffer.length;
            char[] cbuf = new char[bufferSize];
            System.arraycopy(this.buffer, 0, cbuf, 0, this.count);
            this.buffer = cbuf;
        }

        /**
         * 读取新数�?         */
        int length = this.reader.read(this.buffer, this.count, this.buffer.length - this.count);

        if(length > 0) {
            this.count = this.count + length;
        }

        if(offset < this.count) {
            return this.buffer[offset];
        }
        return EOF;
    }
860492
protected int countToken(String token, String target) {
        int tokenIndex = 0;
        int count = 0;
        while (tokenIndex != -1) {
            tokenIndex = target.indexOf(token, tokenIndex);
            if (tokenIndex > -1) {
                tokenIndex++;
                count++;
            }
        }
        return count;
    }
1347410
@SuppressWarnings("ConstantConditions")
    @Beta
    public static int countToken(@Nullable String target, String token) {
        checkArgument(token != null && !token.isEmpty(), "Expected non-empty token, got: '%s'", token);

        if (isNullOrEmpty(target)) {
            return 0;
        }

        int count = 0;
        int tokenIndex = 0;
        while ((tokenIndex = target.indexOf(token, tokenIndex)) != -1) {
            count++;
            tokenIndex += token.length();
        }
        return count;
    }
1320262
def revoke_token(access_token):
    
    response = requests.post(
        get_revoke_token_url(),
        data={
            'token': access_token,
            'client_id': settings.API_CLIENT_ID,
            'client_secret': settings.API_CLIENT_SECRET,
        },
        timeout=15
    )
    return response.status_code == 200
1270718
public static String accessToken(String key) {
		if (isKeyParam(key)) {
			String[] keys = key.split(KEY_JOIN);
			if (keys.length == 2) {
				return apiHandler.accessToken(keys[0], keys[1]);
			} else if (keys.length == 1) {
				return apiHandler.accessToken(keys[0]);
			}
		}
		return key;
	}
517161
public function getAccessToken($access_token)
    {
        return isset($this->accessTokens[$access_token]) ? $this->accessTokens[$access_token] : false;
    }
578317
final public function limit(int $offsetOrCount, int $count = null)
    {
        if ($count === null) {
            $this->limit['offset'] = 0;
            $this->limit['count']  = $offsetOrCount;
        } else {
            $this->limit['offset'] = $offsetOrCount;
            $this->limit['count']  = $count;
        }

        return $this;
    }
952843
public static CodeGetDepositCountResult codeGetDepositCount(String accessToken, CodeGetDepositCount codeCount) {
		return codeGetDepositCount(accessToken,
				JsonUtil.toJSONString(codeCount));
	}
572635
public static StatisticsListResult statisticsList(String accessToken, StatisticsList statisticsList) {
        return statisticsList(accessToken, JsonUtil.toJSONString(statisticsList));
    }
90012
def get_count(self):
        
        params = self.get_params()
        params["offset"] = self.low_mark
        params["limit"] = 1

        r = self.resource._meta.api.http_resource("GET", self.resource._meta.resource_name, params=params)
        data = self.resource._meta.api.resource_deserialize(r.text)

        number = data["meta"]["total_count"]

        # Apply offset and limit constraints manually, since using limit/offset
        # in the API doesn't change the total_count output.
        number = max(0, number - self.low_mark)
        if self.high_mark is not None:
            number = min(number, self.high_mark - self.low_mark)

        return number
1219333
public function getAccessToken($access_token)
    {
        return isset($this->accessTokens[$access_token]) ? $this->accessTokens[$access_token] : null;
    }
1026815
public static int[] split(int amount, int count, int min, int max) {
        Assert.isPositive(amount, "amount必须大于0");
        Assert.isPositive(count, "count必须大于0");
        Assert.isPositive(min, "min必须大于0");
        Assert.isPositive(max, "max必须大于0");

        if (amount < count * min) {
            throw new IllegalArgumentException("参数错误，min * count 不能大于amount");
        }

        if (amount > max * count) {
            throw new IllegalArgumentException("参数错误，max * count 不能小于amount");
        }

        if (min > max) {
            throw new IllegalArgumentException("参数错误，min不能大于max");
        }

        SecureRandom secureRandom = new SecureRandom();
        int nowAmount = amount;

        int[] array = new int[count];

        for (int i = 0; i < count; i++) {
            if (i == (count - 1)) {
                array[i] = nowAmount;
            } else {
                int random = Math.abs(secureRandom.nextInt());
                int nowMax = nowAmount - ((count - i - 1) * min);
                int nowMin = nowAmount - ((count - i - 1) * max);
                //当前允许最小值
                nowMax = Math.min(nowMax, max);
                //当前允许最大值
                nowMin = Math.max(nowMin, min);
                //区间
                int mod = nowMax - nowMin;
                //当前值
                int packet;
                if (mod == 0) {
                    // 此时说明后续的红包都是最小的了
                    packet = nowMin;
                } else {
                    packet = random % mod + nowMin;
                }

                array[i] = packet;
                nowAmount -= packet;
            }
        }
        return array;
    }