コード例 #1
0
        public ActionResult Index(RequestParam <RequestCash> reqst)
        {
            LoggerHelper.Info(reqst);
            ResultInfo <string> res = new ResultInfo <string>("99999");

            int            userId        = ConvertHelper.ParseValue(reqst.body.userId.ToString(), 0);        //用户id
            decimal        Amt           = reqst.body.transAmt;                                              //提现金额
            int            usrBindCardId = ConvertHelper.ParseValue(reqst.body.usrBindCardId.ToString(), 0); //提现卡id
            decimal        servf         = 0.00M;
            string         orderid       = Settings.Instance.OrderCode;
            B_member_table b             = new B_member_table();
            M_member_table p             = new M_member_table();
            M_Cash         mc            = new M_Cash();
            M_ReqExt       mr            = new M_ReqExt();

            p = b.GetModel(userId);
            MemberLogic _logic = new MemberLogic();


            var result = _logic.SelectUserBindCards(usrBindCardId);

            if (result == null || result.Count < 0)
            {
                LoggerHelper.Info("提现失败,用户关联的银行卡不存在:" + JsonHelper.Entity2Json(reqst));
                return(Content("提现失败,用户关联的银行卡不存在!"));
            }
            if (!_logic.IsAllowWithdrawalCash(usrBindCardId, reqst.body.withdrawalType))
            {
                LoggerHelper.Info("提现失败,用户关联的银行卡不支持此类型的取现请求:" + JsonHelper.Entity2Json(reqst));
                return(Content("提现失败,用户关联的银行卡不支持此类型的取现请求!"));
            }

            MemberBankEntity ubc = result.FirstOrDefault();

            if (ubc.UsrCustId == p.UsrCustId)
            {
                mc.Version   = "20";
                mc.CmdId     = "Cash";
                mc.MerCustId = Settings.Instance.MerCustId;
                mc.OrdId     = orderid;
                mc.UsrCustId = p.UsrCustId;
                mc.TransAmt  = Amt.ToString("0.00");

                /*普通取现不收会员手续费*/
                mc.ServFee       = "";
                mc.ServFeeAcctId = Settings.Instance.MerDt;
                mc.OpenAcctId    = ubc.OpenAcctId;
                mc.RetUrl        = Settings.Instance.GetCallbackUrl("/Cash/Index/CashCallback");

                mc.BgRetUrl = Settings.Instance.GetCallbackUrl("/Cash/Index/CashBgCallback");
                mc.Remark   = "";
                mc.CharSet  = "UTF-8";
                mc.MerPriv  = "chuanglitou";
                //if (reqst.body.withdrawalType == 2)
                //    mr.FeeObjFlag = "U";  //客户承担提现手费续
                //else
                mr.FeeObjFlag = "M";  //商家承担提现手费续
                mr.FeeAcctId  = Settings.Instance.MerDt;
                //reqst.body.withdrawalType = 1;
                switch (reqst.body.withdrawalType)
                {
                case 2:
                    mr.CashChl = "IMMEDIATE";
                    break;

                case 1:
                    mr.CashChl = "FAST";
                    break;

                case 0:
                default:
                    mr.CashChl = "GENERAL";     //一般取现
                    break;
                }
                //mr.CashChl = "GENERAL"; //一般取现
                // mr.CashChl = "FAST";  //快速取现
                // mr.CashChl = "IMMEDIATE";  // 即时取现
                mc.ReqExt = "[" + FastJSON.toJOSN(mr) + "]";

                StringBuilder chkVal = new StringBuilder();
                chkVal.Append(mc.Version);
                chkVal.Append(mc.CmdId);
                chkVal.Append(mc.MerCustId);
                chkVal.Append(mc.OrdId);
                chkVal.Append(mc.UsrCustId);
                chkVal.Append(mc.TransAmt);
                chkVal.Append(mc.ServFee);
                chkVal.Append(mc.ServFeeAcctId);
                chkVal.Append(mc.OpenAcctId);
                chkVal.Append(mc.RetUrl);
                chkVal.Append(mc.BgRetUrl);
                chkVal.Append(mc.Remark);
                chkVal.Append(mc.MerPriv);
                chkVal.Append(mc.ReqExt);
                string chkv = chkVal.ToString();

                LoggerHelper.Info("取现chkv字符:" + chkv);

                //私钥文件的位置(这里是放在了站点的根目录下)
                string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Settings.Instance.MerPr;
                //需要指定提交字符串的长度
                int           len        = Encoding.UTF8.GetBytes(chkv).Length;
                StringBuilder sbChkValue = new StringBuilder(256);
                //加签
                int str = DllInterop.SignMsg(Settings.Instance.MerId, merKeyFile, chkv, len, sbChkValue);
                mc.ChkValue = sbChkValue.ToString();
                if (str == 0)
                {
                    M_td_UserCash mu = new M_td_UserCash();
                    B_td_UserCash mo = new B_td_UserCash();
                    mu.registerid = p.registerid;
                    mu.UsrCustId  = p.UsrCustId;
                    mu.TransAmt   = decimal.Parse(mc.TransAmt);
                    mu.FeeAmt     = servf;
                    mu.OrdId      = mc.OrdId;
                    mu.OrdIdTime  = DateTime.Now;
                    mu.OrdIdState = 0;
                    mu.FeeObjFlag = mr.FeeObjFlag;
                    mo.Add(mu);
                }
                LoggerHelper.Info("加签字符:" + str);
                LoggerHelper.Info("提现提交表单:" + JsonHelper.Entity2Json(mc));
                return(View(mc));
            }
            else
            {
                LoggerHelper.Info("提现失败,用户提现的银行卡的关联帐户和当前用户关联的银行卡帐户不一致:" + JsonHelper.Entity2Json(reqst));
                return(Content("提现失败,用户提现的银行卡的关联帐户和当前用户关联的银行卡帐户不一致!"));
            }
        }
コード例 #2
0
ファイル: CashController.cs プロジェクト: DarkMoon4CN/CLT
        public ActionResult CashIMMEDIATE()
        {
            int     userid        = Utils.checkloginsession();
            string  url           = Utils.GetChinapnrUrl();
            decimal Amt           = decimal.Parse(DNTRequest.GetString("TransAmt"));
            int     UsrBindCardID = DNTRequest.GetInt("UsrBindCardID", 0);
            //string vcode = DNTRequest.GetString("vcode");
            string strIdentify = "CashValidateCode"; //随机字串存储键值,以便存储到Session中

            LogInfo.WriteLog("即时取现:userid=" + userid + ";url=" + url + ";Amt=" + Amt + ";UsrBindCardID=" + UsrBindCardID + ";strIdentify=" + strIdentify);

            decimal ServFee = 0.00M;
            //if (Session[strIdentify] != null)
            //{
            //    if (Session[strIdentify].ToString() != vcode)
            //    {
            //        return Content(StringAlert.Alert("验证码不对!"), "text/html");
            //    }
            //}
            //else
            //{
            //    return Content(StringAlert.Alert("验证码已过期!"), "text/html");
            //}
            decimal servf = ServFee;

            ViewBag.errCode = "0";
            B_member_table b = new B_member_table();
            M_member_table p = new M_member_table();

            p = b.GetModel(userid);
            if (p.available_balance < Amt)
            {
                ViewBag.errCode = "-1";
                return(View(new M_Cash()));
            }
            if (Amt <= ServFee)
            {
                return(Content(StringAlert.Alert("取现金额小于或等于手续费,不能提现!"), "text/html"));
            }
            else if (p.available_balance < Amt + ServFee)
            {
                Amt = Amt - ServFee;
            }
            hx_UsrBindCardC ubc = ef.hx_UsrBindCardC.Where(g => g.UsrBindCardID == UsrBindCardID).FirstOrDefault();

            if (ubc == null)
            {
                ViewBag.errCode = "-2";
                return(View(new M_Cash()));
            }
            ViewBag.url = url;
            string FeeObjFlag = "M";//"U";

            string cashChl = Enum.GetName(typeof(EnumCommon.E_hx_td_UserCash.EnumCashChl), (int)EnumCommon.E_hx_td_UserCash.EnumCashChl.IMMEDIATE);
            M_Cash mc      = ChinapnrFacade.Cash(p.UsrCustId, Amt.ToString("0.00"), ubc.OpenAcctId, cashChl, ServFee.ToString("0.00"), FeeObjFlag);

            if (mc != null)
            {
                M_td_UserCash mu = new M_td_UserCash();
                B_td_UserCash mo = new B_td_UserCash();
                mu.registerid = p.registerid;
                mu.UsrCustId  = p.UsrCustId;
                mu.TransAmt   = decimal.Parse(mc.TransAmt);
                mu.FeeAmt     = ChinapnrFacade.CalcCashFee(Amt.ToString("0.00"), cashChl, FeeObjFlag) + servf;
                mu.OrdId      = mc.OrdId;
                mu.OrdIdTime  = DateTime.Now;
                mu.OrdIdState = 0;
                mu.FeeObjFlag = FeeObjFlag;
                mu.CashChl    = cashChl;
                mo.Add(mu);
            }
            return(View("CashQm", mc));
        }
コード例 #3
0
ファイル: CashController.cs プロジェクト: DarkMoon4CN/CLT
        /// <summary>
        /// 提现提交处理方法---快速提现
        /// </summary>
        /// <returns></returns>
        public ActionResult CashGENERAL()
        {
            int     userid        = CurrentUserId;
            string  url           = Utils.GetChinapnrUrl();
            decimal Amt           = decimal.Parse(DNTRequest.GetString("amt"));
            int     UsrBindCardID = DNTRequest.GetInt("UsrBindCardID", 0);
            int     UsrCashType   = DNTRequest.GetInt("UsrCashType", 1);

            /*
             * string vcode = DNTRequest.GetString("vcode");
             * string strIdentify = "CashValidateCode"; //随机字串存储键值,以便存储到Session中
             * if (Session[strIdentify] != null)
             * {
             *  if (Session[strIdentify].ToString() != vcode)
             *  {
             *      return Content(StringAlert.Alert("验证码不对!"), "text/html");
             *  }
             * }
             * else
             * {
             *  return Content(StringAlert.Alert("验证码已过期!"), "text/html");
             * }*/
            ViewBag.errCode = "0";
            B_member_table b = new B_member_table();
            M_member_table p = new M_member_table();

            p = b.GetModel(userid);
            if (p.available_balance < Amt)
            {
                ViewBag.errCode = "-1";
                return(View(new M_Cash()));
            }
            hx_UsrBindCardC ubc = ef.hx_UsrBindCardC.Where(g => g.UsrBindCardID == UsrBindCardID).FirstOrDefault();

            if (ubc == null)
            {
                ViewBag.errCode = "-2";
                return(View(new M_Cash()));
            }
            ViewBag.url = url;
            decimal servf   = 0.00M;
            string  cashChl = Enum.GetName(typeof(EnumCommon.E_hx_td_UserCash.EnumCashChl), (int)EnumCommon.E_hx_td_UserCash.EnumCashChl.GENERAL);
            //string cashType = "FAST";
            string FeeObjFlag = "M";

            if (UsrCashType == 2)
            {
                cashChl = Enum.GetName(typeof(EnumCommon.E_hx_td_UserCash.EnumCashChl), (int)EnumCommon.E_hx_td_UserCash.EnumCashChl.IMMEDIATE);
                //FeeObjFlag = "U";
            }
            //bug 修复,应该为快速提现。此前为普通提现 by fangjianmin
            M_Cash mc = ChinapnrFacade.Cash(p.UsrCustId, Amt.ToString("0.00"), ubc.OpenAcctId, cashChl, servf.ToString("0.00"), FeeObjFlag);

            if (mc != null)
            {
                M_td_UserCash mu = new M_td_UserCash();
                B_td_UserCash mo = new B_td_UserCash();
                mu.registerid = p.registerid;
                mu.UsrCustId  = p.UsrCustId;
                mu.TransAmt   = decimal.Parse(mc.TransAmt);
                mu.FeeAmt     = servf;
                mu.OrdId      = mc.OrdId;
                mu.OrdIdTime  = DateTime.Now;
                mu.OrdIdState = 0;
                mu.FeeObjFlag = FeeObjFlag;
                mu.CashChl    = cashChl;
                mo.Add(mu);
            }
            return(View(mc));
        }