
org.jeewx.api.wxbase.wxserviceip.JwServiceIpAPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeewx-api Show documentation
Show all versions of jeewx-api Show documentation
JEEWX-API(微信极速SDK、同时支持微信公众号\企业微信\支付窗\小程序\微博).
The newest version!
package org.jeewx.api.wxbase.wxserviceip;
import java.util.ArrayList;
import java.util.List;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.ServiceIP;
import org.jeewx.api.core.util.WeiXinConstant;
/**
* 微信--token信息
*
* @author lizr
*
*/
public class JwServiceIpAPI {
/**
* 返回的信息名称
*/
public static String RETURN_INFO_NAME = "ip_list";
/**
* 获取服务的ip列表信息
* @param accessToke
* @return
* @throws WexinReqException
*/
public static List getServiceIpList(String accessToke) throws WexinReqException{
ServiceIP param = new ServiceIP();
param.setAccess_token(accessToke);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(param);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
List lstServiceIp = null;
JSONArray infoArray = result.getJSONArray(RETURN_INFO_NAME);
lstServiceIp = new ArrayList(infoArray.size());
for (int i = 0; i < infoArray.size(); i++) {
lstServiceIp.add(infoArray.getString(i));
}
return lstServiceIp;
}
public static void main(String[] args){
try {
List s = JwServiceIpAPI.getServiceIpList("kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA");
System.out.println(s);
} catch (WexinReqException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy