コード例 #1
0
  /**
   * 获取咨询内容
   *
   * @param id
   * @return
   */
  public static JSONObject getNewsDetail(String id) {
    MyRequestParams params = new MyRequestParams();
    JSONObject resultJson = new JSONObject();
    try {
      resultJson.put("id", id);

      params.setBodyEntity(new StringEntity(resultJson.toString()));
    } catch (JSONException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    JSONObject obj = HttpUtil.sendPostRequest(ConstantValue.URL_NewsDetail, params);
    return obj;
  }
コード例 #2
0
 /**
  * 获取咨询信息列表
  *
  * @param pageIndex 索引页
  * @param type 咨询类型
  * @return
  */
 public static JSONObject getNewsList(int pageIndex, int pageSize, int type) {
   MyRequestParams params = new MyRequestParams();
   JSONObject resultJson = new JSONObject();
   try {
     resultJson.put("pageIndex", pageIndex);
     resultJson.put("pageSize", pageSize);
     resultJson.put("type", type);
     params.setBodyEntity(new StringEntity(resultJson.toString()));
   } catch (JSONException e) {
     e.printStackTrace();
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   }
   JSONObject obj = HttpUtil.sendPostRequest(ConstantValue.URL_NewsList, params);
   return obj;
 }