
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 weixin4j Show documentation
Show all versions of weixin4j Show documentation
微信和钉钉开发SDK,主要提供微信、企业微信、钉钉的JAVA封装,降低集成难度,让API变简单
The newest version!
package org.jeewx.api.wxbase.wxserviceip;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.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;
import java.util.ArrayList;
import java.util.List;
/**
* 微信--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