com.foxinmy.weixin4j.qy.api.HelperApi Maven / Gradle / Ivy
package com.foxinmy.weixin4j.qy.api;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.foxinmy.weixin4j.exception.WeixinException;
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
import com.foxinmy.weixin4j.model.Token;
import com.foxinmy.weixin4j.token.TokenManager;
/**
* 辅助API
*
* @className HelperApi
* @author jinyu([email protected])
* @date 2014年12月28日
* @since JDK 1.6
* @see
*/
public class HelperApi extends QyApi {
private final TokenManager tokenManager;
public HelperApi(TokenManager tokenManager) {
this.tokenManager = tokenManager;
}
/**
* 获取微信服务器IP地址
*
* @return IP地址
* @see 获取IP地址
* @throws WeixinException
*/
public List getWechatServerIp() throws WeixinException {
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
Token token = tokenManager.getCache();
WeixinResponse response = weixinExecutor.get(String.format(getcallbackip_uri,
token.getAccessToken()));
return JSON.parseArray(response.getAsJson().getString("ip_list"),
String.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy