Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_Recharge_history model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hx_Recharge_history set ");
            strSql.Append("membertable_registerid=@membertable_registerid,");
            strSql.Append("recharge_amount=@recharge_amount,");
            strSql.Append("recharge_time=@recharge_time,");
            strSql.Append("account_amount=@account_amount,");
            strSql.Append("order_No=@order_No,");
            strSql.Append("recharge_condition=@recharge_condition,");
            strSql.Append("recharge_bank=@recharge_bank");
            strSql.Append(" where recharge_history_id=@recharge_history_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@membertable_registerid", SqlDbType.Int,         4),
                new SqlParameter("@recharge_amount",        SqlDbType.Decimal,    17),
                new SqlParameter("@recharge_time",          SqlDbType.DateTime),
                new SqlParameter("@account_amount",         SqlDbType.Decimal,    17),
                new SqlParameter("@order_No",               SqlDbType.VarChar,    30),
                new SqlParameter("@recharge_condition",     SqlDbType.Int,         4),
                new SqlParameter("@recharge_bank",          SqlDbType.VarChar,   100),
                new SqlParameter("@recharge_history_id",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.membertable_registerid;
            parameters[1].Value = model.recharge_amount;
            parameters[2].Value = model.recharge_time;
            parameters[3].Value = model.account_amount;
            parameters[4].Value = model.order_No;
            parameters[5].Value = model.recharge_condition;
            parameters[6].Value = model.recharge_bank;
            parameters[7].Value = model.recharge_history_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_Recharge_history DataRowToModel(DataRow row)
        {
            M_Recharge_history model = new M_Recharge_history();

            if (row != null)
            {
                if (row["recharge_history_id"] != null && row["recharge_history_id"].ToString() != "")
                {
                    model.recharge_history_id = int.Parse(row["recharge_history_id"].ToString());
                }
                if (row["membertable_registerid"] != null && row["membertable_registerid"].ToString() != "")
                {
                    model.membertable_registerid = int.Parse(row["membertable_registerid"].ToString());
                }
                if (row["recharge_amount"] != null && row["recharge_amount"].ToString() != "")
                {
                    model.recharge_amount = decimal.Parse(row["recharge_amount"].ToString());
                }
                if (row["recharge_time"] != null && row["recharge_time"].ToString() != "")
                {
                    model.recharge_time = DateTime.Parse(row["recharge_time"].ToString());
                }
                if (row["account_amount"] != null && row["account_amount"].ToString() != "")
                {
                    model.account_amount = decimal.Parse(row["account_amount"].ToString());
                }
                if (row["order_No"] != null)
                {
                    model.order_No = row["order_No"].ToString();
                }
                if (row["recharge_condition"] != null && row["recharge_condition"].ToString() != "")
                {
                    model.recharge_condition = int.Parse(row["recharge_condition"].ToString());
                }
                if (row["recharge_bank"] != null)
                {
                    model.recharge_bank = row["recharge_bank"].ToString();
                }
            }
            return(model);
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_Recharge_history model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hx_Recharge_history(");
            strSql.Append("membertable_registerid,recharge_amount,recharge_time,account_amount,order_No,recharge_condition,recharge_bank)");
            strSql.Append(" values (");
            strSql.Append("@membertable_registerid,@recharge_amount,@recharge_time,@account_amount,@order_No,@recharge_condition,@recharge_bank)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@membertable_registerid", SqlDbType.Int,        4),
                new SqlParameter("@recharge_amount",        SqlDbType.Decimal,   17),
                new SqlParameter("@recharge_time",          SqlDbType.DateTime),
                new SqlParameter("@account_amount",         SqlDbType.Decimal,   17),
                new SqlParameter("@order_No",               SqlDbType.VarChar,   30),
                new SqlParameter("@recharge_condition",     SqlDbType.Int,        4),
                new SqlParameter("@recharge_bank",          SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.membertable_registerid;
            parameters[1].Value = model.recharge_amount;
            parameters[2].Value = model.recharge_time;
            parameters[3].Value = model.account_amount;
            parameters[4].Value = model.order_No;
            parameters[5].Value = model.recharge_condition;
            parameters[6].Value = model.recharge_bank;

            object obj = DbHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_Recharge_history GetModel(int recharge_history_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 recharge_history_id,membertable_registerid,recharge_amount,recharge_time,account_amount,order_No,recharge_condition,recharge_bank from hx_Recharge_history ");
            strSql.Append(" where recharge_history_id=@recharge_history_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@recharge_history_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = recharge_history_id;

            M_Recharge_history model = new M_Recharge_history();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_Recharge_history model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(M_Recharge_history model)
 {
     return(dal.Add(model));
 }
Beispiel #7
0
        /// <summary>
        /// 充值,2
        /// </summary>
        /// <returns></returns>
        public ActionResult Recharge_Money()
        {
            // float money = DNTRequest.GetFormFloat("money", 0);


            M_Recharge_history rh = new M_Recharge_history();
            B_Recharge_history b  = new B_Recharge_history();


            B_UsrBindCard bu = new B_UsrBindCard();
            M_UsrBindCard bm = new M_UsrBindCard();

            decimal amt = DNTRequest.GetDecimal("money", 10000.00M);


            if (amt <= 0)
            {
                return(Content(StringAlert.Alert("充值金额必须大于零!"), "text/html"));
            }

            rh.membertable_registerid = 0;
            rh.recharge_amount        = amt;
            rh.recharge_time          = DateTime.Now;
            rh.account_amount         = amt;
            rh.order_No           = Utils.Createcode();;
            rh.recharge_condition = 0;  //1表示充值成功
            rh.recharge_bank      = ""; // 得接口返回;


            string CmdId      = "NetSave";
            string MerCustId  = Utils.GetMerCustID();
            string GateBusiId = "B2C";
            string UsrCustId  = Utils.GetMerCustID(); //给商户充值
            string MerPriv    = Utils.Base64Encoder("chuanglitou");
            //string MerPriv = "chuanglitou";
            string    ChkValue = "";
            int       Recid    = b.Add(rh);
            M_NetSave mn       = new M_NetSave();

            mn.Version   = "10";
            mn.CmdId     = CmdId;
            mn.MerCustId = MerCustId;
            mn.UsrCustId = UsrCustId;
            mn.OrdId     = rh.order_No;
            mn.OrdDate   = rh.recharge_time.ToString("yyyyMMdd");
            //  mn.GateBusiId = GateBusiId;
            //  mn.OpenBankId = OpenBankId;
            //  mn.DcFlag = DcFlag;
            mn.TransAmt = rh.recharge_amount.ToString("0.00");
            mn.RetUrl   = Utils.GetRe_url("admin/Recharge/Su_Enterpriserecharge");

            // mn.RetUrl = "http://localhost:17745/admin/Recharge/Su_Enterpriserecharge";
            mn.BgRetUrl = Utils.GetRe_url("admin/Thirdparty/Re_Enterpriserecharge");
            mn.MerPriv  = MerPriv;


            StringBuilder str = new StringBuilder();

            str.Append(" <form id=\"formauto\" name=\"formauto\"  action=\"" + Utils.GetChinapnrUrl() + "\" method=\"post\">");

            str.Append("<input id=\"Version\"  name=\"Version\"  type=\"hidden\"  value=\"" + mn.Version + "\" />");

            str.Append("<input id=\"CmdId\"  name=\"CmdId\"    type=\"hidden\"  value=\"" + mn.CmdId + "\" />");

            str.Append("<input id=\"MerCustId\" name=\"MerCustId\"   type=\"hidden\"  value=\"" + mn.MerCustId + "\" />");

            str.Append("<input id=\"UsrCustId\" name=\"UsrCustId\" type=\"hidden\"  value=\"" + mn.UsrCustId + "\" />");

            str.Append("<input id=\"OrdId\" name=\"OrdId\" type=\"hidden\"  value=\"" + mn.OrdId + "\" />");

            str.Append("<input id=\"OrdDate\" name=\"OrdDate\" type=\"hidden\"  value=\"" + mn.OrdDate + "\" />");

            str.Append("<input id=\"TransAmt\" name=\"TransAmt\" type=\"hidden\"  value=\"" + mn.TransAmt + "\" />");

            str.Append("<input id=\"RetUrl\" name=\"RetUrl\"  type=\"hidden\"  value=\"" + mn.RetUrl + "\" />");

            str.Append("<input id=\"BgRetUrl\" name=\"BgRetUrl\" type=\"hidden\"  value=\"" + mn.BgRetUrl + "\" />");

            str.Append("<input id=\"MerPriv\" name=\"MerPriv\" type=\"hidden\"  value=\"" + mn.MerPriv + "\" />");


            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(mn.Version);
            chkVal.Append(mn.CmdId);
            chkVal.Append(mn.MerCustId);
            chkVal.Append(mn.UsrCustId);
            chkVal.Append(mn.OrdId);
            chkVal.Append(mn.OrdDate);
            chkVal.Append(mn.TransAmt);
            chkVal.Append(mn.RetUrl);
            chkVal.Append(mn.BgRetUrl);
            chkVal.Append(mn.MerPriv);



            string chkv = chkVal.ToString();

            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr();
            //需要指定提交字符串的长度
            int           len        = Encoding.UTF8.GetBytes(chkv).Length;
            StringBuilder sbChkValue = new StringBuilder(256);
            //加签
            int str1 = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue);

            // Response.Write((str1.ToString()));

            // ChkValue = sbChkValue.ToString();

            mn.ChkValue = sbChkValue.ToString();

            //
            str.Append("<input id=\"ChkValue\"  name=\"ChkValue\" type=\"hidden\"  value=\"" + mn.ChkValue + "\" />");

            str.Append(" </form>");

            str.Append("<script type=\"text/javascript\">document.getElementById('formauto').submit();</script>");

            LogInfo.WriteLog("企业充值提交表单:" + str.ToString());

            ViewBag.str = str.ToString();

            return(View());
        }
Beispiel #8
0
        public ActionResult RechargeSubmit(RequestParam <RequestRecharge> reqst)
        {
            LoggerHelper.Info(JsonHelper.Entity2Json(reqst));
            MemberLogic   mLogic    = new MemberLogic();
            StringBuilder str       = new StringBuilder();
            string        blankName = reqst.body.bankType;
            int           userid    = reqst.body.userId;
            var           p         = mLogic.SelectMemberByUserId(reqst.body.userId);

            if (p.UsrCustId.Length <= 0)
            {
                RequestParam <RequestValidate> vldParam = new RequestParam <RequestValidate>();
                RequestValidate rv = new RequestValidate();
                rv.userId     = reqst.body.userId.ToString();
                vldParam.body = rv;
                return(RedirectToAction("RequestRealName", "Index", new { area = "UserAuthentication", userId = reqst.body.userId.ToString() }));//未实名,跳转至实名接口
            }

            #region 提现审核时,如果出现没有快捷卡时,禁止提现,防止用户绑定快捷卡
            string openAcctIds  = string.Empty;
            var    userCardList = mLogic.SelectUserBankList(userid);
            var    quickList    = new List <MemberBankEntity>();
            if (userCardList == null)
            {
                userCardList = new List <MemberBankEntity>();
            }
            if (userCardList != null)
            {
                quickList = userCardList.Where(d => d.BindCardType == 1).ToList();
            }

            if (quickList == null || quickList.Count == 0) //用户没有快捷卡时,有提现审核都拒绝
            {
                foreach (var item in userCardList)
                {
                    if (openAcctIds == string.Empty)
                    {
                        openAcctIds += "'" + item.OpenAcctId + "'";
                    }
                    else
                    {
                        openAcctIds += "," + "'" + item.OpenAcctId + "'";
                    }
                }
                //if (string.IsNullOrWhiteSpace(openAcctIds))
                //{
                //    LoggerHelper.Info("充值请求失败!未绑定银行卡,暂不能进行此操作!" + JsonHelper.Entity2Json(reqst));
                //    return Content("充值请求失败!未绑定银行卡,暂不能进行此操作!");
                //}
                try
                {
                    if (!string.IsNullOrWhiteSpace(openAcctIds))
                    {
                        bool isExist = mLogic.SelectVUserCashBank(openAcctIds, 0);
                        if (isExist)
                        {
                            LoggerHelper.Info("充值失败,提现审核中,暂不能进行其他操作" + JsonHelper.Entity2Json(reqst));
                            return(Content("充值审核中,暂不能进行其他操作!"));
                        }
                    }
                }
                catch
                {
                    LoggerHelper.Error("充值数据出现异常,提现审核中,暂不能进行其他操作。SelectVUserCashBank,openAcctIds=" + openAcctIds + "===>" + JsonHelper.Entity2Json(reqst));
                }
            }
            #endregion



            string             UsrCustId = p.UsrCustId; //这个是给用户充值  在充值前得保证商户余额足够
            decimal            amt       = reqst.body.amountOfCharge;
            M_QPNetSave        qp        = new M_QPNetSave();
            M_Recharge_history rh        = new M_Recharge_history();
            rh.membertable_registerid = reqst.body.userId;
            rh.recharge_amount        = Math.Round(amt, 2);
            rh.recharge_time          = DateTime.Now;
            rh.account_amount         = amt;
            rh.order_No           = Settings.Instance.OrderCode;
            rh.recharge_condition = 0;         //1表示充值成功
            rh.recharge_bank      = blankName; // 得接口返回;

            string CmdId     = "NetSave";
            string MerCustId = Settings.Instance.MerCustId;

            var ckd = Settings.Instance.SiteDomain;
            RechargeHistoryLogic hLogic = new RechargeHistoryLogic();


            int Recid = hLogic.Add(rh);
            if (Recid > 0)
            {
                string MerPriv = EncryptHelper.Encrypt(reqst.body.userId + "_" + Recid, Settings.Instance.WebPass);

                qp.Version    = "10";
                qp.CmdId      = CmdId;
                qp.MerCustId  = MerCustId;
                qp.UsrCustId  = UsrCustId;
                qp.OrdId      = rh.order_No;
                qp.OrdDate    = rh.recharge_time.ToString("yyyyMMdd");
                qp.GateBusiId = "QP";  //快捷支付
                qp.OpenBankId = blankName;
                qp.DcFlag     = "D";
                qp.TransAmt   = amt.ToString("0.00");
                qp.RetUrl     = Settings.Instance.GetCallbackUrl("/Recharge/Index/SuQPNetSave");
                qp.BgRetUrl   = Settings.Instance.GetCallbackUrl("/Recharge/Index/ReQPNetSave");
                qp.MerPriv    = MerPriv;


                StringBuilder chkVal = new StringBuilder();
                chkVal.Append(qp.Version);
                chkVal.Append(qp.CmdId);
                chkVal.Append(qp.MerCustId);
                chkVal.Append(qp.UsrCustId);
                chkVal.Append(qp.OrdId);
                chkVal.Append(qp.OrdDate);
                chkVal.Append(qp.GateBusiId);
                chkVal.Append(qp.OpenBankId);
                chkVal.Append(qp.DcFlag);
                chkVal.Append(qp.TransAmt);
                chkVal.Append(qp.RetUrl);
                chkVal.Append(qp.BgRetUrl);
                chkVal.Append(qp.OpenAcctId);
                // chkVal.Append(qp.CertId);
                chkVal.Append(qp.MerPriv);
                string chkv = chkVal.ToString();
                //私钥文件的位置(这里是放在了站点的根目录下)
                string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Settings.Instance.MerPr;
                //需要指定提交字符串的长度
                int           len        = Encoding.UTF8.GetBytes(chkv).Length;
                StringBuilder sbChkValue = new StringBuilder(256);
                //加签
                int str1 = DllInterop.SignMsg(Settings.Instance.MerId, merKeyFile, chkv, len, sbChkValue);
                qp.ChkValue = sbChkValue.ToString();
                str.Append(" <form id=\"formauto\" name=\"formauto\"  action=\"" + Settings.Instance.ChinapnrUrl + "\" method=\"post\">");

                str.Append("<input id=\"Version\"  name=\"Version\"  type=\"hidden\"  value=\"" + qp.Version + "\" />");

                str.Append("<input id=\"CmdId\"  name=\"CmdId\"    type=\"hidden\"  value=\"" + qp.CmdId + "\" />");

                str.Append("<input id=\"MerCustId\" name=\"MerCustId\"   type=\"hidden\"  value=\"" + qp.MerCustId + "\" />");

                str.Append("<input id=\"UsrCustId\" name=\"UsrCustId\" type=\"hidden\"  value=\"" + qp.UsrCustId + "\" />");

                str.Append("<input id=\"OrdId\" name=\"OrdId\" type=\"hidden\"  value=\"" + qp.OrdId + "\" />");

                str.Append("<input id=\"OrdDate\" name=\"OrdDate\" type=\"hidden\"  value=\"" + qp.OrdDate + "\" />");

                str.Append("<input id=\"GateBusiId\"  name=\"GateBusiId\" type=\"hidden\"  value=\"" + qp.GateBusiId + "\" />");

                str.Append("<input id=\"OpenBankId\"   name=\"OpenBankId\" type=\"hidden\"  value=\"" + qp.OpenBankId + "\" />");

                str.Append("<input id=\"DcFlag\" name=\"DcFlag\" type=\"hidden\"  value=\"" + qp.DcFlag + "\" />");

                str.Append("<input id=\"TransAmt\" name=\"TransAmt\" type=\"hidden\"  value=\"" + qp.TransAmt + "\" />");

                str.Append("<input id=\"RetUrl\" name=\"RetUrl\"  type=\"hidden\"  value=\"" + qp.RetUrl + "\" />");

                str.Append("<input id=\"BgRetUrl\" name=\"BgRetUrl\" type=\"hidden\"  value=\"" + qp.BgRetUrl + "\" />");

                //  str.Append("<input id=\"CertId\" name=\"CertId\" type=\"hidden\"  value=\"" + qp.CertId + "\" />");

                str.Append("<input id=\"MerPriv\" name=\"MerPriv\" type=\"hidden\"  value=\"" + qp.MerPriv + "\" />");

                str.Append("<input id=\"ChkValue\"  name=\"ChkValue\" type=\"hidden\"  value=\"" + qp.ChkValue + "\" />");

                str.Append(" </form>");

                str.Append("<script type=\"text/javascript\">document.getElementById('formauto').submit();</script>");

                LoggerHelper.Info("快捷充值提交表单:" + str.ToString());
            }
            ViewBag.str = str.ToString();

            return(View());
        }
Beispiel #9
0
        /// <summary>
        /// 充值汇付后台主动通知
        /// </summary>
        /// <returns></returns>
        public ActionResult ReQPNetSave()
        {
            string str1 = "";

            lock (this)
            {
                Settings.Instance.SetSYSDateTimeFormat();

                ReQPNetSave m = new ReQPNetSave();

                m.CmdId      = DNTRequest.GetString("CmdId");
                m.RespCode   = DNTRequest.GetString("RespCode");
                m.RespDesc   = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc"));
                m.MerCustId  = DNTRequest.GetString("MerCustId");
                m.UsrCustId  = DNTRequest.GetString("UsrCustId");
                m.OrdId      = DNTRequest.GetString("OrdId");
                m.OrdDate    = DNTRequest.GetString("OrdDate");
                m.TransAmt   = DNTRequest.GetString("TransAmt");
                m.TrxId      = DNTRequest.GetString("TrxId");
                m.GateBusiId = DNTRequest.GetString("GateBusiId");
                m.GateBankId = DNTRequest.GetString("GateBankId");
                m.FeeAmt     = DNTRequest.GetString("FeeAmt");
                m.FeeCustId  = DNTRequest.GetString("FeeCustId");
                m.FeeAcctId  = DNTRequest.GetString("FeeAcctId");
                m.RetUrl     = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl"));
                m.BgRetUrl   = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl"));
                m.CardId     = DNTRequest.GetString("CardId");
                m.MerPriv    = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv"));
                // m.MerPriv = DESEncrypt.Decrypt(DNTRequest.GetString("MerPriv"), ConfigurationManager.AppSettings["webp"].ToString());
                m.ChkValue = DNTRequest.GetString("ChkValue");

                StringBuilder chkVal = new StringBuilder();
                chkVal.Append(m.CmdId);
                chkVal.Append(m.RespCode);
                chkVal.Append(m.MerCustId);
                chkVal.Append(m.UsrCustId);
                chkVal.Append(m.OrdId);
                chkVal.Append(m.OrdDate);
                chkVal.Append(m.TransAmt);
                chkVal.Append(m.TrxId);
                chkVal.Append(m.RetUrl);
                chkVal.Append(m.BgRetUrl);
                chkVal.Append(m.MerPriv);
                string msg = chkVal.ToString();

                //私钥文件的位置(这里是放在了站点的根目录下)
                string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Settings.Instance.PgPubk;
                //需要指定提交字符串的长度
                int           len        = Encoding.UTF8.GetBytes(msg).Length;
                StringBuilder sbChkValue = new StringBuilder(256);
                int           ret        = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue);
                // Response.Write("验签:" + ret.ToString());
                LoggerHelper.Info("快充接口后台验签:ret=" + ret.ToString() + " RespCode:" + m.RespCode + m.RespDesc);

                LoggerHelper.Info("快充接口后台充值返回报文:" + JsonHelper.Entity2Json(m));
                StringBuilder str = new StringBuilder();
                string        sql = "";

                if (ret == 0)
                {
                    if (m.RespCode == "000")
                    {
                        string   MerPrivTemp = EncryptHelper.Decrypt(m.MerPriv, Settings.Instance.WebPass);
                        string[] arr         = Settings.Instance.SplitString(MerPrivTemp, "_"); //第一位是用户id 二是 记录id
                        int      userid      = int.Parse(arr[0]);
                        int      reid        = int.Parse(arr[1]);
                        string   cachename   = m.OrdId + userid.ToString() + reid.ToString();

                        if (Settings.Instance.GeTThirdCache(cachename) == 0)
                        {
                            Settings.Instance.SetThirdCache(cachename);
                            sql = "select recharge_condition  from hx_Recharge_history where recharge_condition=0  and recharge_history_id=" + reid + " and order_No='" + m.OrdId + "'";
                            DataTable dtr = DbHelper.Query(sql).Tables[0];
                            if (dtr.Rows.Count > 0)
                            {
                                LoggerHelper.Info("快充接口后台充值数据没有写入情况下操作>>>>>>>>>>>>>>>>>>>>>>>");
                                M_Recharge_history      rh = new M_Recharge_history();
                                M_Capital_account_water aw = new M_Capital_account_water();
                                B_member_table          o  = new B_member_table();
                                M_member_table          p  = new M_member_table();
                                p = o.GetModel(userid);
                                rh.membertable_registerid = userid;
                                rh.recharge_amount        = decimal.Parse(m.TransAmt);
                                rh.recharge_time          = DateTime.Now;
                                rh.account_amount         = decimal.Parse(m.TransAmt);
                                rh.order_No               = m.OrdId;
                                rh.recharge_condition     = 1;            //1表示充值成功
                                rh.recharge_bank          = m.GateBankId; // 得接口返回;
                                rh.recharge_history_id    = reid;         //本值提交里存的充值id
                                aw.membertable_registerid = userid;
                                aw.income             = decimal.Parse(m.TransAmt);
                                aw.expenditure        = 0.00M;
                                aw.time_of_occurrence = rh.recharge_time;
                                aw.account_balance    = p.available_balance + aw.income; //要得么帐户余额
                                aw.types_Finance      = (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.充值.ToString());
                                aw.createtime         = DateTime.Now;
                                aw.keyid   = 0;
                                aw.remarks = m.OrdId;
                                B_usercenter BUC    = new B_usercenter();
                                int          bucrec = BUC.rechargeTran(rh, aw);
                                LoggerHelper.Info("后台充值事务操作返回码小于=0 操作失败:" + bucrec.ToString());
                                if (m.GateBusiId == "QP")
                                {
                                    sql = "select UsrBindCardID from hx_UsrBindCardC where UsrCustId='" + m.UsrCustId + "' and OpenAcctId='" + m.CardId + "'";
                                    DataTable dt = DbHelper.Query(sql).Tables[0];
                                    if (dt.Rows.Count > 0)
                                    {
                                    }
                                    else
                                    {
                                        sql = "INSERT INTO hx_UsrBindCardC (UsrCustId,OpenAcctId,OpenBankId,defCard) VALUES ('" + m.UsrCustId + "','" + m.CardId + "','" + m.GateBankId + "',1)";
                                        DbHelper.Query(sql);
                                        sql = "update hx_member_table set  isbankcard=1 where registerid=" + userid.ToString();
                                        DbHelper.Query(sql);
                                    }
                                }
                            }
                        }
                        str1 = "RECV_ORD_ID_" + m.TrxId;
                    }
                }
            }
            return(Content(str1));
        }
Beispiel #10
0
        /// <summary>
        /// 充值
        /// </summary>
        /// <param name="p">用户信息实体</param>
        /// <param name="rh">充值记录信息</param>
        /// <param name="blankName">充值银行 CMB CCB 等等</param>
        /// <param name="recid">充值记录信息ID</param>
        /// <param name="isQP">是否是快捷支付</param>
        /// <returns></returns>
        public static M_QPNetSave NetSave(M_member_table p, M_Recharge_history rh, string blankName = "CMB", int recid = 0, bool isQP = false)
        {
            M_QPNetSave m         = new M_QPNetSave();
            string      MerPriv   = DESEncrypt.Encrypt(p.registerid.ToString() + "_" + recid.ToString(), ConfigurationManager.AppSettings["webp"].ToString());
            string      cmdId     = "NetSave";
            string      merCustId = Utils.GetMerCustID();

            m.Version   = "10";
            m.CmdId     = cmdId;
            m.MerCustId = merCustId;
            m.UsrCustId = p.UsrCustId;
            m.OrdId     = rh.order_No;
            m.OrdDate   = rh.recharge_time.ToString("yyyyMMdd");

            if (isQP == false)
            {
                if (p.UsrCustId == Utils.GetDanbaoCustID())
                {
                    m.GateBusiId = "B2B"; //企业网银
                }
                else
                {
                    m.GateBusiId = "B2C";
                }
            }
            else
            {
                m.GateBusiId = "QP";  //快捷支付
            }
            m.OpenBankId = blankName;
            m.DcFlag     = "D";
            m.TransAmt   = rh.account_amount.ToString();
            m.RetUrl     = Utils.GetRe_url("usercenter/SuQPNetSave");
            m.BgRetUrl   = Utils.GetRe_url("Thirdparty/ReQPNetSave");
            m.MerPriv    = MerPriv;

            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(m.Version);
            chkVal.Append(m.CmdId);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.OrdId);
            chkVal.Append(m.OrdDate);
            chkVal.Append(m.GateBusiId);
            chkVal.Append(m.OpenBankId);
            chkVal.Append(m.DcFlag);
            chkVal.Append(m.TransAmt);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.OpenAcctId);
            chkVal.Append(m.MerPriv);
            string chkv = chkVal.ToString();
            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr();
            //需要指定提交字符串的长度
            int           len        = Encoding.UTF8.GetBytes(chkv).Length;
            StringBuilder sbChkValue = new StringBuilder(256);
            //加签
            int ret = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue);

            m.ChkValue = sbChkValue.ToString();
            LogInfo.WriteLog("加签字符:" + ret.ToString() + "投标chkv字符:" + chkv);
            LogInfo.WriteLog("投标提交表单报文:" + FastJSON.toJOSN(m));
            return(m);
        }