Exemple #1
0
        public ActionResult PostGENERALAmt()
        {
            //显示于页面给汇付
            string str = string.Empty;
            //日志变量
            string log = string.Empty;
            //响应通知加签的状态码
            int ret = -1;
            //业务的sql语句变量
            string sql = string.Empty;
            ReCash m   = ChinapnrFacade.CashCallBack(out ret);

            if (m != null)
            {
                //提现成功后,得多事务处理账户金额,流水及冻结金额等
                if (m.RespCode == "000")
                {
                    string cachename = m.OrdId + "Cash" + m.UsrCustId;
                    if (Utils.GeTThirdCache(cachename) == 0)
                    {
                        Utils.SetThirdCache(cachename);
                        B_usercenter BUC    = new B_usercenter();
                        M_ReqExt     mre    = JsonConvert.DeserializeObject <M_ReqExt>(m.RespExt.Replace("[", "").Replace("]", ""));
                        int          CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.RealTransAmt, m.UsrCustId, m.FeeAmt, mre.FeeObjFlag, mre.CashChl);
                        if (CashOp > 0)
                        {
                            sql = "select registerid,username,mobile,UsrCustId,available_balance from hx_member_table where UsrCustId='" + m.UsrCustId + "'";
                            LogInfo.WriteLog("审请取现成功短信sql:" + sql);
                            DataTable dt = DbHelperSQL.GET_DataTable_List(sql);
                            if (dt.Rows.Count > 0)
                            {
                                //短信通知
                                //尊敬的#USERANEM#,您已成功提现#MONEY#元,账户余额#MONEY1#.请注意查收!【创利投】
                                string        contxt = Utils.GetMSMEmailContext(12, 1); // 获取注册成功邮件内容
                                StringBuilder sbsms  = new StringBuilder(contxt);
                                sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString());
                                sbsms = sbsms.Replace("#MONEY#", m.TransAmt);
                                decimal amt = decimal.Parse(dt.Rows[0]["available_balance"].ToString()) - decimal.Parse(m.TransAmt);
                                sbsms = sbsms.Replace("#MONEY1#", amt.ToString());
                                string          mobile  = dt.Rows[0]["mobile"].ToString();
                                M_td_SMS_record psms    = new M_td_SMS_record();
                                B_td_SMS_record osms    = new B_td_SMS_record();
                                int             smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.取现成功.ToString());
                                psms.phone_number = mobile;
                                psms.sendtime     = DateTime.Now;
                                psms.senduserid   = int.Parse(dt.Rows[0]["registerid"].ToString());
                                psms.smstype      = smstype;
                                psms.smscontext   = sbsms.ToString();
                                psms.orderid      = SendSMS.Send_SMS(mobile, sbsms.ToString());
                                psms.vcode        = "";
                                osms.Add(psms);
                                DateTime            dti = DateTime.Now;
                                M_td_System_message pm  = new M_td_System_message();
                                pm.MReg     = int.Parse(dt.Rows[0]["registerid"].ToString());
                                pm.Mstate   = 0;
                                pm.MTitle   = "提现";
                                pm.MContext = sbsms.ToString();
                                pm.PubTime  = dti;
                                pm.Mtype    = 3;
                                B_usercenter.AddMessage(pm);
                            }
                            string cashChl = Enum.GetName(typeof(EnumCommon.E_hx_td_UserCash.EnumCashChl), (int)EnumCommon.E_hx_td_UserCash.EnumCashChl.IMMEDIATE);

                            if (mre.CashChl == cashChl && decimal.Parse(m.TransAmt) <= 200000M)
                            {
                                string retUrl   = Utils.GetRe_url("admin/UserCash/RePostCashProcessing");
                                string bgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgCashProcessing");
                                BusinessLogicHelper.AutoCheckCash(m.UsrCustId, retUrl, bgRetUrl);
                            }
                        }
                    }
                }
            }
            return(View(m));
        }
Exemple #2
0
        /// <summary>
        /// 普通提现汇付后台主动通知
        /// </summary>
        /// <returns></returns>
        public ActionResult PostGENERALAmt()
        {
            string str1 = "";
            ReCash m    = new ReCash();

            m.CmdId         = DNTRequest.GetString("CmdId");
            m.RespCode      = DNTRequest.GetString("RespCode");
            m.RespDesc      = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc"));
            m.MerCustId     = DNTRequest.GetString("MerCustId");
            m.OrdId         = DNTRequest.GetString("OrdId");
            m.UsrCustId     = DNTRequest.GetString("UsrCustId");
            m.TransAmt      = DNTRequest.GetString("TransAmt");
            m.OpenAcctId    = DNTRequest.GetString("OpenAcctId");
            m.OpenBankId    = DNTRequest.GetString("OpenBankId");
            m.FeeAmt        = DNTRequest.GetString("FeeAmt");
            m.FeeCustId     = DNTRequest.GetString("FeeCustId");
            m.FeeAcctId     = DNTRequest.GetString("FeeAcctId");
            m.ServFee       = DNTRequest.GetString("ServFee");
            m.ServFeeAcctId = DNTRequest.GetString("ServFeeAcctId");
            m.RetUrl        = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl"));
            m.BgRetUrl      = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl"));
            m.MerPriv       = DNTRequest.GetString("MerPriv");
            m.RespExt       = HttpUtility.UrlDecode(DNTRequest.GetString("RespExt"));
            m.ChkValue      = DNTRequest.GetString("ChkValue");
            LogInfo.WriteLog("后台取现返回报文:" + FastJSON.toJOSN(m));

            //验签
            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(m.CmdId);
            chkVal.Append(m.RespCode);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.OrdId);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.TransAmt);
            chkVal.Append(m.OpenAcctId);
            chkVal.Append(m.OpenBankId);
            chkVal.Append(m.FeeAmt);
            chkVal.Append(m.FeeCustId);
            chkVal.Append(m.FeeAcctId);
            chkVal.Append(m.ServFee);
            chkVal.Append(m.ServFeeAcctId);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.MerPriv);
            chkVal.Append(m.RespExt);

            string msg = chkVal.ToString();

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

            int ret = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue);

            // LogInfo.WriteLog("验签返回参数:" + ret.ToString());
            StringBuilder str = new StringBuilder();

            if (ret == 0)
            {
                //提现成功后,得多事务处理账户金额,流水及冻结金额等
                if (m.RespCode == "000")
                {
                    string cachename = m.OrdId + "Cash" + m.UsrCustId;

                    if (Utils.GeTThirdCache(cachename) == 0)
                    {
                        Utils.SetThirdCache(cachename);
                        B_usercenter BUC    = new B_usercenter();
                        M_ReqExt     mre    = JsonConvert.DeserializeObject <M_ReqExt>(m.RespExt.Replace("[", "").Replace("]", ""));
                        int          CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.TransAmt, m.UsrCustId, m.FeeAmt, mre.FeeObjFlag, mre.CashChl);
                        //int CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.TransAmt, m.UsrCustId);
                        if (CashOp > 0)
                        {
                            string sql = "select registerid,username,mobile,UsrCustId,available_balance from hx_member_table where UsrCustId='" + m.UsrCustId + "'";
                            LogInfo.WriteLog("后台审请取现成功短信sql:" + sql);
                            DataTable dt = DbHelperSQL.GET_DataTable_List(sql);
                            if (dt.Rows.Count > 0)
                            {
                                //短信通知
                                //尊敬的#USERANEM#,您已成功提现#MONEY#元,账户余额#MONEY1#.请注意查收!【创利投】
                                string contxt = Utils.GetMSMEmailContext(12, 1); // 获取注册成功邮件内容

                                StringBuilder sbsms = new StringBuilder(contxt);

                                sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString());

                                sbsms = sbsms.Replace("#MONEY#", m.TransAmt);

                                decimal amt = decimal.Parse(dt.Rows[0]["available_balance"].ToString()) - decimal.Parse(m.TransAmt);

                                sbsms = sbsms.Replace("#MONEY1#", amt.ToString());

                                string mobile = dt.Rows[0]["mobile"].ToString();

                                M_td_SMS_record psms    = new M_td_SMS_record();
                                B_td_SMS_record osms    = new B_td_SMS_record();
                                int             smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.取现成功.ToString());
                                psms.phone_number = mobile;
                                psms.sendtime     = DateTime.Now;
                                psms.senduserid   = int.Parse(dt.Rows[0]["registerid"].ToString());
                                psms.smstype      = smstype;
                                psms.smscontext   = sbsms.ToString();
                                psms.orderid      = SendSMS.Send_SMS(mobile, sbsms.ToString());
                                psms.vcode        = "";
                                osms.Add(psms);
                                DateTime            dti = DateTime.Now;
                                M_td_System_message pm  = new M_td_System_message();
                                pm.MReg     = int.Parse(dt.Rows[0]["registerid"].ToString());
                                pm.Mstate   = 0;
                                pm.MTitle   = "提现成功";
                                pm.MContext = sbsms.ToString();
                                pm.PubTime  = dti;
                                pm.Mtype    = 3;
                                B_usercenter.AddMessage(pm);


                                if (mre.CashChl == "IMMEDIATE" && decimal.Parse(m.TransAmt) <= 200000M)
                                {
                                    string retUrl   = Utils.GetRe_url("admin/UserCash/RePostCashProcessing");
                                    string bgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgCashProcessing");
                                    BusinessLogicHelper.AutoCheckCash(m.UsrCustId, retUrl, bgRetUrl);
                                }
                            }
                        }
                    }


                    str1 = "RECV_ORD_ID_" + m.OrdId;
                }
            }
            return(Content(str1));
        }
Exemple #3
0
        /// <summary>
        /// 汇付主动通知页面
        /// </summary>
        /// <returns></returns>
        public ActionResult CashBgCallback()
        {
            string str1 = "";
            ReCash m    = new ReCash();

            m.CmdId         = DNTRequest.GetString("CmdId");
            m.RespCode      = DNTRequest.GetString("RespCode");
            m.RespDesc      = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc"));
            m.MerCustId     = DNTRequest.GetString("MerCustId");
            m.OrdId         = DNTRequest.GetString("OrdId");
            m.UsrCustId     = DNTRequest.GetString("UsrCustId");
            m.TransAmt      = DNTRequest.GetString("TransAmt");
            m.OpenAcctId    = DNTRequest.GetString("OpenAcctId");
            m.OpenBankId    = DNTRequest.GetString("OpenBankId");
            m.FeeAmt        = DNTRequest.GetString("FeeAmt");
            m.FeeCustId     = DNTRequest.GetString("FeeCustId");
            m.FeeAcctId     = DNTRequest.GetString("FeeAcctId");
            m.ServFee       = DNTRequest.GetString("ServFee");
            m.ServFeeAcctId = DNTRequest.GetString("ServFeeAcctId");
            m.RetUrl        = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl"));
            m.BgRetUrl      = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl"));
            m.MerPriv       = DNTRequest.GetString("MerPriv");
            m.RespExt       = HttpUtility.UrlDecode(DNTRequest.GetString("RespExt"));
            m.ChkValue      = DNTRequest.GetString("ChkValue");
            m.RealTransAmt  = DNTRequest.GetString("RealTransAmt");
            LoggerHelper.Info("后台取现返回报文:" + JsonHelper.Entity2Json(m));

            //验签
            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(m.CmdId);
            chkVal.Append(m.RespCode);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.OrdId);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.TransAmt);
            chkVal.Append(m.OpenAcctId);
            chkVal.Append(m.OpenBankId);
            chkVal.Append(m.FeeAmt);
            chkVal.Append(m.FeeCustId);
            chkVal.Append(m.FeeAcctId);
            chkVal.Append(m.ServFee);
            chkVal.Append(m.ServFeeAcctId);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.MerPriv);
            chkVal.Append(m.RespExt);

            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);

            // LoggerHelper.Info("验签返回参数:" + ret.ToString());
            StringBuilder str = new StringBuilder();

            if (ret == 0)
            {
                //提现成功后,得多事务处理账户金额,流水及冻结金额等
                if (m.RespCode == "000")
                {
                    string cachename = m.OrdId + "Cash" + m.UsrCustId;

                    if (Settings.Instance.GeTThirdCache(cachename) == 0)
                    {
                        Settings.Instance.SetThirdCache(cachename);
                        B_usercenter BUC = new B_usercenter();
                        M_ReqExt     mr  = new M_ReqExt();
                        mr = FastJSON.ToObject <M_ReqExt>(m.RespExt.Replace("[", "").Replace("]", ""));
                        int CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.RealTransAmt, m.UsrCustId, m.FeeAmt, mr.FeeObjFlag, mr.CashChl);
                        if (CashOp > 0)
                        {
                            string sql = "select registerid,username,mobile,UsrCustId,available_balance from hx_member_table where UsrCustId='" + m.UsrCustId + "'";
                            LoggerHelper.Info("后台审请取现成功短信sql:" + sql);
                            DataTable dt = DbHelper.Query(sql).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                //短信通知
                                //尊敬的#USERANEM#,您已成功提现#MONEY#元,账户余额#MONEY1#.请注意查收!【创利投】
                                MemberLogic _logic = new MemberLogic();

                                var    ebt    = _logic.GetSmsEmailEntity(1, 12); // 获取内容
                                string contxt = ebt.SEContext;

                                StringBuilder sbsms = new StringBuilder(contxt);

                                sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString());

                                sbsms = sbsms.Replace("#MONEY#", m.TransAmt);

                                decimal amt = decimal.Parse(dt.Rows[0]["available_balance"].ToString()) - decimal.Parse(m.TransAmt);

                                sbsms = sbsms.Replace("#MONEY1#", amt.ToString());

                                string mobile = dt.Rows[0]["mobile"].ToString();

                                M_td_SMS_record psms    = new M_td_SMS_record();
                                B_td_SMS_record osms    = new B_td_SMS_record();
                                int             smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.取现成功.ToString());
                                psms.phone_number = mobile;
                                psms.sendtime     = DateTime.Now;
                                psms.senduserid   = int.Parse(dt.Rows[0]["registerid"].ToString());
                                psms.smstype      = smstype;
                                psms.smscontext   = sbsms.ToString();
                                psms.orderid      = SendSMS.Send(mobile, sbsms.ToString());
                                psms.vcode        = "";
                                osms.Add(psms);
                                DateTime            dti = DateTime.Now;
                                M_td_System_message pm  = new M_td_System_message();
                                pm.MReg     = int.Parse(dt.Rows[0]["registerid"].ToString());
                                pm.Mstate   = 0;
                                pm.MTitle   = "投现成功";
                                pm.MContext = sbsms.ToString();
                                pm.PubTime  = dti;
                                pm.Mtype    = 3;
                                B_usercenter.AddMessage(pm);

                                //即时提现,提现金额小于等于20万自动审核,高于20万人工审核
                                string cashChl = Enum.GetName(typeof(EnumCommon.E_hx_td_UserCash.EnumCashChl), (int)EnumCommon.E_hx_td_UserCash.EnumCashChl.IMMEDIATE);
                                if (mr.CashChl == cashChl && decimal.Parse(m.TransAmt) <= 200000)
                                {
                                    string retUrl   = Settings.Instance.ImagesDomain + "/admin/UserCash/RePostCashProcessing";
                                    string bgRetUrl = Settings.Instance.ImagesDomain + "/admin/Thirdparty/BgCashProcessing";
                                    BusinessLogicHelper.AutoCheckCash(m.UsrCustId, retUrl, bgRetUrl);
                                }
                            }
                        }
                    }
                    str1 = "RECV_ORD_ID_" + m.OrdId;
                }
            }
            return(Content(str1));
        }
Exemple #4
0
        /// <summary>
        /// 提现回调
        /// </summary>
        /// <param name="ret">out 返回状态值</param>
        /// <param name="isFront">是否是前台form形式调用</param>
        /// <returns></returns>
        public static ReCash CashCallBack(out int ret, bool isFront = true)
        {
            ReCash m = new ReCash();

            m.CmdId         = DNTRequest.GetString("CmdId");
            m.RespCode      = DNTRequest.GetString("RespCode");
            m.RespDesc      = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc"));
            m.MerCustId     = DNTRequest.GetString("MerCustId");
            m.OrdId         = DNTRequest.GetString("OrdId");
            m.UsrCustId     = DNTRequest.GetString("UsrCustId");
            m.TransAmt      = DNTRequest.GetString("TransAmt");
            m.OpenAcctId    = DNTRequest.GetString("OpenAcctId");
            m.OpenBankId    = DNTRequest.GetString("OpenBankId");
            m.FeeAmt        = DNTRequest.GetString("FeeAmt");
            m.FeeCustId     = DNTRequest.GetString("FeeCustId");
            m.FeeAcctId     = DNTRequest.GetString("FeeAcctId");
            m.ServFee       = DNTRequest.GetString("ServFee");
            m.ServFeeAcctId = DNTRequest.GetString("ServFeeAcctId");
            m.RetUrl        = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl"));
            m.BgRetUrl      = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl"));
            m.MerPriv       = DNTRequest.GetString("MerPriv");
            m.RespExt       = HttpUtility.UrlDecode(DNTRequest.GetString("RespExt"));
            m.ChkValue      = DNTRequest.GetString("ChkValue");
            m.RealTransAmt  = DNTRequest.GetString("RealTransAmt");
            //验签
            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(m.CmdId);
            chkVal.Append(m.RespCode);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.OrdId);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.TransAmt);
            chkVal.Append(m.OpenAcctId);
            chkVal.Append(m.OpenBankId);
            chkVal.Append(m.FeeAmt);
            chkVal.Append(m.FeeCustId);
            chkVal.Append(m.FeeAcctId);
            chkVal.Append(m.ServFee);
            chkVal.Append(m.ServFeeAcctId);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.MerPriv);
            chkVal.Append(m.RespExt);
            string msg = chkVal.ToString();
            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk();
            //需要指定提交字符串的长度
            int           len        = Encoding.UTF8.GetBytes(msg).Length;
            StringBuilder sbChkValue = new StringBuilder(256);

            ret = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue);

            LogInfo.WriteLog("取现接口" + (isFront ? "前台" : "后台") + "返回结果验签:ret=" + ret.ToString() + " RespCode:" + m.RespCode + m.RespDesc);
            LogInfo.WriteLog("取现接口" + (isFront ? "前台" : "后台") + "返回报文:" + FastJSON.toJOSN(m));
            if (ret == 0)
            {
                return(m);
            }
            return(null);
        }