コード例 #1
0
  public void getWishes(
      String page,
      String order_by,
      OnQueryCompleteListener onQueryCompleteListener,
      final Context context) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("order_by", order_by));
    parms.add(new BasicNameValuePair("page", page));
    parms.add(new BasicNameValuePair("pagesize", "6"));
    parms.add(new BasicNameValuePair("university", Utils.curUniversity));
    parms.add(new BasicNameValuePair("school", Utils.school));
    HttpUtils.makeAsyncPost(
        GETWISHESACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, LISTWISH) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub
            Map<String, Object> wishes;
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              Gson gson = new Gson();
              Type type = new TypeToken<Map<String, Object>>() {}.getType();
              wishes = gson.fromJson(jsonResult, type);
              saveCache(context, jsonResult);
              @SuppressWarnings("unchecked")
              List<Map<String, Object>> list = (List<Map<String, Object>>) wishes.get("wishes");
              this.completeListener.onQueryComplete(LISTWISH, list, error);
            } else {
              this.completeListener.onQueryComplete(LISTWISH, null, error);
            }
          }
        });
  }
コード例 #2
0
  /*
   * @function 发起心愿书单
   *
   * @param
   *
   * @return
   */
  public void addWish(Map<String, Object> map, OnQueryCompleteListener onQueryCompleteListener) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("type", map.get("type").toString()));
    parms.add(new BasicNameValuePair("user_id", map.get("user_id").toString()));
    parms.add(new BasicNameValuePair("wish_id", map.get("wish_id").toString()));
    parms.add(new BasicNameValuePair("bookname", map.get("bookname").toString()));
    parms.add(new BasicNameValuePair("username", map.get("username").toString()));
    parms.add(new BasicNameValuePair("description", map.get("description").toString()));
    parms.add(new BasicNameValuePair("mobile", map.get("mobile").toString()));
    parms.add(new BasicNameValuePair("qq", map.get("qq").toString()));
    parms.add(new BasicNameValuePair("weixin", map.get("wexin").toString()));
    parms.add(new BasicNameValuePair("img1", map.get("img1").toString()));
    parms.add(new BasicNameValuePair("reward", map.get("reward").toString()));
    if (map.containsKey("price")) {
      parms.add(new BasicNameValuePair("price", map.get("price").toString()));
    }
    HttpUtils.makeAsyncPost(
        ADDWISHESACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, new QueryId()) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              this.completeListener.onQueryComplete(new QueryId(), jsonResult, error);
            } else {
              this.completeListener.onQueryComplete(new QueryId(), null, error);
            }
          }
        });
  }
コード例 #3
0
  /*
   * @function 评论心愿书单
   *
   * @parms
   *
   * @return
   */
  public void makeWishComment(
      String object_id,
      String user_id,
      String username,
      String content,
      OnQueryCompleteListener onQueryCompleteListener) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("object_id", object_id));
    parms.add(new BasicNameValuePair("user_id", user_id));
    parms.add(new BasicNameValuePair("username", username));
    parms.add(new BasicNameValuePair("content", content));

    HttpUtils.makeAsyncPost(
        MAKECOMMENTSACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, MAKECOMMENT) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub\
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              this.completeListener.onQueryComplete(MAKECOMMENT, jsonResult, error);
            }
          }
        });
  }
コード例 #4
0
  /*
   * 最新
   */
  public void clickListener(String wishid, OnQueryCompleteListener onQueryCompleteListener) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("wish_id", wishid));
    HttpUtils.makeAsyncPost(
        CLICKWISHACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, CLICKWISH) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              this.completeListener.onQueryComplete(CLICKWISH, jsonResult, error);
            } else {
              this.completeListener.onQueryComplete(CLICKWISH, jsonResult, error);
            }
          }
        });
  }
コード例 #5
0
  /*
   * @function 获取心愿书单详情
   *
   * @parms
   *
   * @return
   */
  public void getWishDetail(String wish_id, OnQueryCompleteListener onQueryCompleteListener) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("wish_id", wish_id));
    HttpUtils.makeAsyncPost(
        WISHDETAILACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, GetWishDetail) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub\
            Map<String, Object> map;
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              Gson gson = new Gson();
              Type type = new TypeToken<Map<String, Object>>() {}.getType();
              map = gson.fromJson(jsonResult, type);
              this.completeListener.onQueryComplete(GetWishDetail, map, error);
            }
          }
        });
  }
コード例 #6
0
  /*
   * @function 获取心愿书单评论
   *
   * @parms
   *
   * @return
   */
  public void getWishComment(String object_id, OnQueryCompleteListener onQueryCompleteListener) {
    List<BasicNameValuePair> parms = new ArrayList<BasicNameValuePair>();
    parms.add(new BasicNameValuePair("object_id", object_id));
    HttpUtils.makeAsyncPost(
        GETWISHCOMMENTACTION,
        parms,
        new QueryCompleteHandler(onQueryCompleteListener, GETCOMMENT) {

          @Override
          public void handleResponse(String jsonResult, EHttpError error) {
            // TODO Auto-generated method stub\
            Map<String, Object> wishes;
            if (jsonResult != null && error == EHttpError.KErrorNone) {
              Gson gson = new Gson();
              Type type = new TypeToken<Map<String, Object>>() {}.getType();
              wishes = gson.fromJson(jsonResult, type);
              List<Map<String, Object>> list = (List<Map<String, Object>>) wishes.get("comments");
              this.completeListener.onQueryComplete(GETCOMMENT, list, error);
            }
          }
        });
  }