Пример #1
0
  private void update_db(GoodsBean goods) {
    int userid = UserUtil.getuserid(context);
    // 判断这个sock是否已经存在数据库
    boolean exist = DBUtil.CheckSchoolBuyCartGoodsExist(context, goods.getId());
    if (exist) {

      Log.v(TAG, "  存在     id " + goods.getId() + "  count  " + goods.getCount());

      // 存在,更新操作
      DBUtil.updateSchoolBuyCartCount(context, goods);
    } else {
      // 不存在,新增

      Log.v(TAG, "  不存在,新增       id " + goods.getId() + "  count  " + goods.getCount());

      DBUtil.insertSchoolBuyCart(context, goods);
    }
    // 发广播修改 界面数量变化
    Intent updateProxyStockCartCount = new Intent();
    updateProxyStockCartCount.setAction(GlobalConstant.UpdateSchoolBuyCartCount);
    context.sendBroadcast(updateProxyStockCartCount);
  }
Пример #2
0
  @Override
  public void onResp(BaseResp resp) {
    Log.d(TAG, "onPayFinish, errCode = " + resp.errCode);

    String msg = "";

    if (resp.errCode == 0) {
      msg = "支付成功";
    } else if (resp.errCode == -1) {
      msg = "已取消支付";
    } else if (resp.errCode == -2) {
      msg = "支付失败";
    }

    if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setTitle(R.string.app_tip);
      builder.setMessage(msg);
      builder.show();
    }
  }