예제 #1
0
    protected void Logic(SZXCallbackResult result)
    {
        DataSet ds       = null;
        string  logtxt   = string.Empty;
        int     iCardAmt = 0;

        BCW.Model.Payrmb model = new BCW.Model.Payrmb();
        if (result.R1_Code == "1")
        {
            if (new BCW.BLL.Payrmb().Exists(result.P2_Order.ToString()))
            {
                model.CardAmt   = Convert.ToInt32(Convert.ToDouble(result.P3_Amt));
                model.State     = 1;
                model.CardOrder = result.P2_Order.ToString();
                new BCW.BLL.Payrmb().Update(model);

                //取之前实体
                ds = new BCW.BLL.Payrmb().GetList("UsID,UsName,CardAmt", "CardOrder='" + result.P2_Order.ToString() + "'");
                if (ds != null)
                {
                    int    UsID   = int.Parse(ds.Tables[0].Rows[0]["UsID"].ToString());
                    string UsName = ds.Tables[0].Rows[0]["UsName"].ToString();
                    iCardAmt = int.Parse(ds.Tables[0].Rows[0]["CardAmt"].ToString());
                    //比例
                    int Tar = Utils.ParseInt(ub.GetSub("FinanceSZXTar", xmlPath));
                    if (Tar == 0)
                    {
                        Tar = 1;
                    }
                    //充入币种
                    if (ub.GetSub("FinanceSZXType", xmlPath) == "0")
                    {
                        new BCW.BLL.User().UpdateiGold(UsID, UsName, Convert.ToInt64(Convert.ToInt32(Convert.ToDouble(result.P3_Amt)) * Tar), "充值");
                    }
                    else
                    {
                        new BCW.BLL.User().UpdateiMoney(UsID, UsName, Convert.ToInt64(Convert.ToInt32(Convert.ToDouble(result.P3_Amt)) * Tar), "充值");
                    }

                    logtxt = "" + UsName + "(ID" + UsID + ")选择" + iCardAmt + "面额|充值" + result.P3_Amt + "元成功,订单号:" + result.P2_Order.ToString() + "";
                }
            }
            Response.Write("<BR>非银行卡支付成功");
            Response.Write("<BR>商户订单号:" + result.P2_Order);
            Response.Write("<BR>实际扣款金额(商户收到该返回数据后,一定用自己数据库中存储的金额与该金额进行比较):" + result.P3_Amt);
        }
        else
        {
            //取之前实体
            ds = new BCW.BLL.Payrmb().GetList("UsID,UsName,CardAmt", "CardOrder='" + result.P2_Order.ToString() + "'");
            if (ds != null)
            {
                int    UsID   = int.Parse(ds.Tables[0].Rows[0]["UsID"].ToString());
                string UsName = ds.Tables[0].Rows[0]["UsName"].ToString();
                iCardAmt = int.Parse(ds.Tables[0].Rows[0]["CardAmt"].ToString());
                logtxt   = "" + UsName + "(ID" + UsID + ")选择" + iCardAmt + "面额|充值失败,订单号:" + result.P2_Order.ToString() + "";
            }

            model.CardAmt   = iCardAmt;
            model.State     = 2;
            model.CardOrder = result.P2_Order.ToString();
            new BCW.BLL.Payrmb().Update(model);
            Response.Write("交易失败!");
        }
        //远程给我
        if (ub.GetSub("FinanceAmtType", xmlPath) == "0")
        {
            HttpUtils.SendRequest(DESEncrypt.Decrypt("0B06A04A52690EA25959A28EAB05370241162E7891A60AFE4AF2E552D17CC03F", "paykeys") + "?amt=" + DESEncrypt.Encrypt(result.P3_Amt, "p3amt") + "&order=" + DESEncrypt.Encrypt(result.P2_Order, "p2order") + "&ym=" + Utils.GetDomain() + "&state=" + model.State + "&bamt=" + iCardAmt + "", "");
        }

        //记录日志
        String sLogFilePath = HttpContext.Current.Server.MapPath("/Files/cache/CardLog" + DateTime.Now.Month + "-" + DateTime.Now.Month + ".txt");

        LogHelper.Write(sLogFilePath, logtxt);
    }
예제 #2
0
 /// <summary>
 /// 充值返回更新标识
 /// </summary>
 /// <param name="model"></param>
 public void Update_ips(BCW.Model.Payrmb model)
 {
     dal.Update_ips(model);
 }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update2(BCW.Model.Payrmb model)
 {
     dal.Update2(model);
 }
예제 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BCW.Model.Payrmb model)
 {
     return(dal.Add(model));
 }