/** 获取展厅列表数据 */ private void getIQueryExhibitionPage() { CustomResponseHandler handler = new CustomResponseHandler(mContext, true, "正在加载...") { @Override public void onSuccess(String content) { sv_exhibition.onRefreshComplete(); super.onSuccess(content); if (LogUtil.isDebug) Log.i(TAG, "展厅数据:" + content); bean = IQueryExhibitionPageBean.explainJson(content, mContext); if (null != bean) { update(bean); } } @Override public void onFinish() { super.onFinish(); sv_exhibition.onRefreshComplete(); } @Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); sv_exhibition.onRefreshComplete(); Toast.makeText(mContext, "网络错误", Toast.LENGTH_LONG).show(); } }; RequestParams params = new RequestParams(); params.put("curPage", pageIndex + ""); params.put("pageSize", pageSize + ""); HttpClient.iQueryExhibitionPage(handler, params); }
/** * 获取账户中心信息 * * @param userId */ private void getIQueryUserCenterInfo(String userId) { CustomResponseHandler mHandler = new CustomResponseHandler(getActivity()) { @Override public void onSuccess(String content) { super.onSuccess(content); if (LogUtil.isDebug) Log.i(TAG, "用户中心信息:" + content); UserCenterBean bean = UserCenterBean.explainJson(content, getActivity()); initView(bean); } }; RequestParams params = new RequestParams(); params.put("uid", userId); HttpClient.iQueryUserCenterInfo(mHandler, params); }
/** 请求数据 */ private void getData() { CustomResponseHandler hanndHandler = new CustomResponseHandler(mContext, true, "正在加载...") { @Override public void onSuccess(int statusCode, Header[] headers, String content) { super.onSuccess(statusCode, headers, content); iUserInfo = IUserInfo.explainJson(content, mContext); if (null != iUserInfo) { init(); } } }; RequestParams params = new RequestParams(); params.put("sellerId", uid); HttpClient.iUserInfo(hanndHandler, params); }
private void loadCanSendGoods() { CustomResponseHandler mHandler = new CustomResponseHandler(this.getActivity(), true, "正在加载...") { @Override public void onSuccess(int statusCode, String content) { super.onSuccess(statusCode, content); int type = Integer.valueOf(JSONParseUtils.getString(content, "type")); Log.d(TAG1, "loadCanSendGoods result:" + content + ",type = " + type); if (!JSONParseUtils.isErrorJSONResult(content)) { List<RefundGoodBean> list = JSONParseUtils.refundGoodBeans( content, RefundGoodSizeBean.TYPE_EXCHANGE_SEND, ""); if (cid == null) { cid = JSONParseUtils.getString( JSONParseUtils.getJSONObject(content, "dtMap"), "address_cid"); } factoryName = JSONParseUtils.getString( JSONParseUtils.getJSONObject(content, "dtMap"), "f_factory_name"); tip_no_content.setText("该订单中没有可进行换货的商品哦!"); addSendGoods(list); setView(); } else { Log.d(TAG1, "可退款货单信息获取失败"); tip_no_content.setText("数据获取异常"); return; } } @Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); Log.d(TAG1, "loadCanSendGoods onFailure: content:" + content); tip_no_content.setText("服务器异常"); showToast("服务器异常"); } }; uid = AppContext.userInfo.id; RequestParams params = new RequestParams(); // 不可空 params.put("uid", uid); // 不可空 params.put("seller_id", seller_id); // 不可空 HttpClient.loadExchangeInfo(mHandler, params); }
private void uploadExchangeApply() { CustomResponseHandler mHandler = new CustomResponseHandler(this.getActivity(), true, "正在提交...") { @Override public void onSuccess(int statusCode, String content) { super.onSuccess(statusCode, content); Log.d(TAG1, "uploadExchangeApply result:" + content); int type = Integer.valueOf(JSONParseUtils.getString(content, "type")); if (type > 0) { showToast("换货申请提交成功"); // init(); ActivitySwitch.finishActivity(ExchangeProductFragment.this.getActivity()); } else { Log.d(TAG1, "提交换货申请失败"); tip_no_content.setText("提交换货申请失败"); showToast("换货申请提交失败,type = " + type); return; } } @Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); Log.d(TAG1, "uploadExchangeApply onFailure: content:" + content); tip_no_content.setText("服务器异常"); showToast("服务器异常"); } }; setCommitApplyParams(); RequestParams params = new RequestParams(); // 不可空 params.put("uid", uid); // 不可空 params.put("oids", oids); // 不可空 params.put("dataArr", dataArr); // 不可空 params.put("dataArrOut", dataArrOut); // 不可空 params.put("cid", cid); // 不可空 params.put("desc", desc); // 可空 HttpClient.uploadExchangeApply(mHandler, params); }
private void searchProduct() { getCurPage(); CustomResponseHandler mHandler = new CustomResponseHandler(mContext, true, "正在加载...") { @Override public void onFinish() { super.onFinish(); if (shoesListFragment.isCreatedView()) shoesListFragment.setOnFooterRefreshComplete(); } @Override public void onSuccess(int statusCode, String content) { super.onSuccess(statusCode, content); Log.d(TAG1, "searchProduct result:" + content); if (JSONParseUtils.isErrorJSONResult(content)) { Log.d(TAG1, "商品搜索失败"); return; } else { List<ProductBean> lists = JSONParseUtils.parseProductBeans(content); Log.d(TAG1, "onSuccess lists size = " + lists.size() + ", mode = " + mode); setCurPageX(); switch (mode) { case -1: mDataMultiple.addAll(lists); shoesListFragment.reflesh(mDataMultiple, mode); break; case 1: mDataSale.addAll(lists); shoesListFragment.reflesh(mDataSale, mode); break; case 2: if (priceOrd == -1) { mDataPriceInc.addAll(lists); shoesListFragment.reflesh(mDataPriceInc, mode); } else if (priceOrd == 1) { mDataPriceDec.addAll(lists); shoesListFragment.reflesh(mDataPriceDec, mode); } break; default: break; } if (lists.size() == 0) showNoMoreToast(lists); if (mFilterItemBeans.size() == 0) { mFilterItemBeans = JSONParseUtils.ParseFilterItems(content); productFilterFragment.setData(mFilterItemBeans); } } } @Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); Log.d(TAG, "onFailure: content:" + content); } }; RequestParams params = new RequestParams(); String type = null; Log.d(TAG1, "searchKey = " + searchKey + ",curPage = " + curPage + ",mode = " + mode); params.put("serachKey", searchKey); params.put("curPage", curPage + ""); params.put("pageSize", pageSize + ""); params.put("pps", pps); params.put("fel", mode + ""); params.put("ord", priceOrd + ""); params.put("pri", pri); params.put("pri2", pri2); params.put("bid", bid); HttpClient.LoadSearchProduct(mHandler, params); }