Ejemplo n.º 1
0
 /** 请求数据方法 */
 public void asyncDownload() {
   String schoolid = PreferenceHelper.readString(this, "setting", Const.SCHOOLID);
   RequestParams params = new RequestParams();
   params.put("schoolid", schoolid);
   asyncHttpClient.post(
       HealthCareApi.HttpUntil.httppath + adURL, params, downloadHttpResponseHandler);
 }
Ejemplo n.º 2
0
 /** 请求数据方法 */
 public void asyncAll(int page) {
   RequestParams params = new RequestParams();
   params.put("schoolid", schoolid);
   params.put("page", page + "");
   // params.put("edittime", list.get(list.size() - 1).getEdittime()
   // .substring(0, 19));
   asyncHttpClient.post(HealthCareApi.HttpUntil.httppath + URL, params, jsonHttpResponseHandler);
 }
  @Override
  protected void executeCommand() {
    // 处理请求,这里是子线程操作
    TARequest request = getRequest();
    String command = (String) request.getTag();
    if (command.equals(SEND_COMMENT)) {

      String[] obj = (String[]) request.getData();
      String nickname = obj[0];
      String content = obj[1];
      String score = obj[2];
      String appId = obj[3];

      RequestParams params = new RequestParams();
      params.put("uuid", InfoUtil.getUUID(TAApplication.getApplication()));
      params.put("nickname", nickname);
      params.put("content", content);
      params.put("score", score);
      params.put("appID", appId);
      CDataDownloader.getPostData(
          CDataDownloader.getDoCommentUrl(),
          params,
          new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String content) {
              super.onSuccess(content);
              int status = DataParser.parsePublishData(content);
              DoCommentsController.this.sendSuccessMessage(status);
            }

            @Override
            public void onFailure(Throwable error) {
              super.onFailure(error);
              DoCommentsController.this.sendFailureMessage(error.getMessage());
            }
          });

    } else if (command.equals(SEND_FEEDBACK)) {
      RequestParams params = new RequestParams();
      String[] obj = (String[]) request.getData();
      params.put("contact", obj[0]);
      params.put("content", obj[1]);
      params.put("uuid", InfoUtil.getUUID(TAApplication.getApplication()));
      params.put("imei", InfoUtil.getIMEI(TAApplication.getApplication()));
      CDataDownloader.getPostData(
          CDataDownloader.getFeedbackUrl(),
          params,
          new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String content) {

              JSONObject json;
              int statusCode = -1;
              try {
                json = new JSONObject(content);
                statusCode = json.optInt("statusCode", -1);
              } catch (JSONException e) {
                e.printStackTrace();
              }

              DoCommentsController.this.sendSuccessMessage(statusCode);
            }

            @Override
            public void onStart() {}

            @Override
            public void onFailure(Throwable error) {
              DoCommentsController.this.sendFailureMessage(error);
            }

            @Override
            public void onFinish() {}
          });
    }
  }
Ejemplo n.º 4
0
 /** 请求数据方法 */
 public void asyncAll() {
   RequestParams params = new RequestParams();
   params.put("classid", Const.userInfo.getClassId());
   asyncHttpClient.post(HealthCareApi.HttpUntil.httppath + URL, params, jsonHttpResponseHandler);
 }