package api.jisuapi.mobilerecharge; /** * 查询话费订单列表 */ import api.util.HttpUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class Orderlist { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/mobilerecharge/orderlist"; public static final int pagenum = 1;//当前页 public static final int pagesize = 20;//每页数量,最大20 public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY + "&pagenum=" + pagenum + "&pagesize=" + pagesize; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = (JSONObject) json.opt("result"); String total = resultarr.getString("total"); String pagenum = resultarr.getString("pagenum"); String pagesize = resultarr.getString("pagesize"); System.out.println(total + " " + pagenum + " " + pagesize); JSONArray list = resultarr.optJSONArray("list"); for (int i = 0; i < list.size(); i++) { JSONObject obj = (JSONObject) list.opt(i); String orderno = obj.getString("orderno"); String outorderno = obj.getString("outorderno"); String account = obj.getString("account"); String num = obj.getString("num"); String status = obj.getString("status"); String rechargestatus = obj.getString("rechargestatus"); String amount = obj.getString("amount"); String totalfee = obj.getString("totalfee"); String addtime = obj.getString("addtime"); String name = obj.getString("name"); String areaid = obj.getString("areaid"); String company = obj.getString("company"); System.out.println(orderno + " " + outorderno + " " + account + " " + num + " " + status + " " + rechargestatus + " " + amount + " " + totalfee + " " + addtime + " " + name + " " + areaid + " " + company); } } } catch (Exception e) { e.printStackTrace(); } } }