public void getShopInfo() {
    if (NetUtils.isNetworkConnected(getApplicationContext())) {
      ApiManager.getService(getApplicationContext())
          .getShopInfo(
              shop_id,
              new Callback<ShopInfoRes>() {
                @Override
                public void success(ShopInfoRes shopInfoRes, Response response) {
                  initData(shopInfoRes);
                }

                @Override
                public void failure(RetrofitError error) {
                  TLog.i("error", error.getMessage());
                  showInnerError(error);
                }
              });
    } else {
      showNetWorkError();
    }
  }
  private void updateGoodInfo(String good_id, final int is_active) {
    if (!NetUtils.isNetworkConnected(mContext)) {
      progressDialog.dismiss();
      showNetWorkError();
      return;
    }

    UpdateGoodReq goodReq = new UpdateGoodReq();
    goodReq.setIs_active(is_active);
    ApiManager.getService(mContext)
        .updateGoodInfo(
            good_id,
            goodReq,
            new Callback<CommonStatusRes>() {
              @Override
              public void success(CommonStatusRes commonStatusRes, Response response) {
                if (commonStatusRes != null) {
                  progressDialog.dismiss();
                  if (is_active == 0) {
                    showToast(getString(R.string.pull_off_success));
                    firstGetData = true;
                    goodPage = 1;
                    getSelfGoods();
                  } else {
                    showToast(getString(R.string.on_sale_success));
                    firstGetData = true;
                    goodPage = 1;
                    getSelfGoods();
                  }
                }
              }

              @Override
              public void failure(RetrofitError error) {
                progressDialog.dismiss();
                showInnerError(error);
              }
            });
  }
  private void checkShop() {
    if (NetUtils.isNetworkConnected(getApplicationContext())) {
      ApiManager.getService(getApplicationContext())
          .getShopStatus(
              new Callback<ShopStatusRes>() {
                @Override
                public void success(ShopStatusRes shopStatusRes, Response response) {
                  if (shopStatusRes.getStatus().equals("ok")) {
                    showToast("恭喜您的店铺通过审核!");
                    readyGoThenKill(MainActivity.class);
                  } else {
                    showToast("您的店铺还在审核中,请耐心等候!");
                  }
                }

                @Override
                public void failure(RetrofitError error) {
                  showInnerError(error);
                }
              });
    } else {
      showNetWorkError();
    }
  }
  // 获取自己的商品列表
  private void getSelfGoods() {
    if (firstGetData) {
      toggleShowLoading(true, null);
    }

    if (!NetUtils.isNetworkConnected(mContext)) {
      showNetWorkError();
      if (firstGetData) {
        toggleNetworkError(true, getGoodsClickListener);
      }
      listView.setLoading(false);
      swipeRefreshLayout.setRefreshing(false);
      return;
    }

    ApiManager.getService(mContext)
        .getSelfGoods(
            goodPage,
            is_active,
            null,
            new Callback<GetSelfGoodsRes>() {
              @Override
              public void success(GetSelfGoodsRes getSelfGoodsRes, Response response) {
                if (getSelfGoodsRes != null) {
                  listView.setLoading(false);
                  swipeRefreshLayout.setRefreshing(false);

                  if (goodPage == 1 && getSelfGoodsRes.getGoods().size() == 0) {
                    toggleShowEmpty(true, getString(R.string.no_good), null);
                    return;
                  }

                  if (goodPage != 1 && getSelfGoodsRes.getGoods().size() == 0) {
                    showToast(getString(R.string.no_more));
                    return;
                  }

                  if (is_active == 1) {
                    if (firstGetData) {
                      onSaleListAdapter =
                          new OnSaleListAdapter(
                              mContext,
                              getSelfGoodsRes.getGoods(),
                              OnSaleListAdapter.ViewHolder.class);
                      listView.setAdapter(onSaleListAdapter);
                      onSaleListAdapter.setOnGoodPullOffClickListener(
                          new OnSaleListAdapter.OnGoodPullOffClickListener() {
                            @Override
                            public void onPullOffClick(String good_id, int position) {
                              initProgressDialog();
                              progressDialog.setContent(mContext.getString(R.string.in_pull_off));
                              progressDialog.show();
                              updateGoodInfo(good_id, 0);
                            }
                          });

                      onSaleListAdapter.setOnGoodEditClickListener(
                          new OnSaleListAdapter.OnGoodEditClickListener() {
                            @Override
                            public void onEditClick(String good_id) {
                              Bundle bundle = new Bundle();
                              bundle.putInt(EditGoodInfoAct.IN_WAY, EditGoodInfoAct.IN_FROM_EDIT);
                              bundle.putString(EditGoodInfoAct.GOOD_ID, good_id);
                              readyGo(EditGoodInfoAct.class, bundle);
                            }
                          });
                      toggleRestore();
                      firstGetData = false;
                    } else {
                      onSaleListAdapter.addEntities(getSelfGoodsRes.getGoods());
                      onSaleListAdapter.notifyDataSetChanged();
                    }
                  } else {
                    if (firstGetData) {
                      pullOffListAdapter =
                          new PullOffListAdapter(
                              mContext,
                              getSelfGoodsRes.getGoods(),
                              PullOffListAdapter.ViewHolder.class);
                      listView.setAdapter(pullOffListAdapter);
                      pullOffListAdapter.setOnGoodEditClickListener(
                          new PullOffListAdapter.OnGoodEditClickListener() {
                            @Override
                            public void onEditClick(String good_id) {
                              Bundle bundle = new Bundle();
                              bundle.putInt(EditGoodInfoAct.IN_WAY, EditGoodInfoAct.IN_FROM_EDIT);
                              bundle.putString(EditGoodInfoAct.GOOD_ID, good_id);
                              readyGo(EditGoodInfoAct.class, bundle);
                            }
                          });

                      pullOffListAdapter.setOnGoodSaleClickListener(
                          new PullOffListAdapter.OnGoodSaleClickListener() {
                            @Override
                            public void onSaleClick(String good_id, int position) {
                              initProgressDialog();
                              progressDialog.setContent(mContext.getString(R.string.in_pull_off));
                              progressDialog.show();
                              updateGoodInfo(good_id, 1);
                            }
                          });
                      toggleRestore();
                      firstGetData = false;
                    } else {
                      pullOffListAdapter.addEntities(getSelfGoodsRes.getGoods());
                      pullOffListAdapter.notifyDataSetChanged();
                    }
                  }
                }
              }

              @Override
              public void failure(RetrofitError error) {
                if (goodPage == 1) {
                  toggleShowEmpty(true, null, getGoodsClickListener);
                } else {
                  showInnerError(error);
                }
                listView.setLoading(false);
                swipeRefreshLayout.setRefreshing(false);
              }
            });
  }