Exemplo n.º 1
0
  // getSta(): 获取统计信息
  // 返回json(paytimes:消费次数,paycount:支付总额,incometimes:收入次数,incomecount:收入总额)
  public static String getStaResultForHttpGet() throws ClientProtocolException, IOException {
    String path = NetworkUtils.HostIP + "recharge/getSta.html";

    // http://open.zhizhi.com/recharge/getSta.html?amount=amount&code=code
    String uri = path;
    String result = "";
    HttpResponse response = NetworkUtils.getHttpResponseResultForHttpGet(uri);

    if (response.getStatusLine().getStatusCode() == 200) {
      HttpEntity entity = response.getEntity();
      result = EntityUtils.toString(entity, HTTP.UTF_8);
    } else {
      result = "error";
    }
    Log.i(TAG, "result=" + result);

    return result;
  }
Exemplo n.º 2
0
  // setBank(bank,card_id,name,address): 设置银行
  // 返回json(state,msg)
  public static String setBankResultForHttpGet(
      String bank, String card_id, String name, String address)
      throws ClientProtocolException, IOException {
    String path = NetworkUtils.HostIP + "recharge/setBank.html?";

    // http://open.zhizhi.com/recharge/setBank.html?amount=amount&code=code
    String uri =
        path + "bank=" + bank + "&card_id=" + card_id + "&name=" + name + "&address=" + address;
    String result = "";
    HttpResponse response = NetworkUtils.getHttpResponseResultForHttpGet(uri);

    if (response.getStatusLine().getStatusCode() == 200) {
      HttpEntity entity = response.getEntity();
      result = EntityUtils.toString(entity, HTTP.UTF_8);
    } else {
      result = "error";
    }
    Log.i(TAG, "result=" + result);

    return result;
  }