示例#1
0
        protected void ActiveCgt()
        {
            Guid userid   = WebUserAuth.UserId.Value;
            var  usermode = new UserBLL().GetUserBasicInfoModelById(userid);

            if (usermode != null)
            {
                var cgtmode = new QueryClient().GetUserByPlatformUserNo(userid);
                if (cgtmode == null || cgtmode.accountStage == 1)
                {
                    Response.Redirect("/Member/cgt/openCgt.aspx", false);
                    return;
                }
                string rtn = string.Empty;
                if (usermode.UserTypeId == 1)
                {
                    string      errorMessage = string.Empty;
                    string      respData     = string.Empty;
                    QueryClient cli          = new QueryClient();
                    bool        isCli        = cli.QUERY_USER_INFORMATION_API(userid, ref errorMessage, ref respData);
                    if (isCli)
                    {
                        //QUERY_USER_INFORMATION
                        QUERY_USER_INFORMATION_Response model = Newtonsoft.Json.JsonConvert.DeserializeObject <QUERY_USER_INFORMATION_Response>(respData);
                        if ((model != null) && (model.isImportUserActivate))
                        {
                            bool result = TuanDai.CunGuanTong.Client.UserClient.USER_INFORMATION_CHECK(userid, ref errorMessage);
                            if (result)
                            {
                                Response.Redirect("/Member/my_account.aspx");
                                return;
                            }
                        }
                    }

                    ACTIVATE_IMPORT_USER_Request request = new ACTIVATE_IMPORT_USER_Request();

                    request.callbackUrl    = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.ActivateImportUser);
                    request.platformUserNo = userid.ToString();
                    request.userDevice     = userDevice.MOBILE;
                    rtn      = UserClient.ACTIVATE_IMPORT_USER_Req(request);
                    strGoUrl = rtn;
                    return;
                }
                else
                {
                    StrErr = "暂时不支持企业用户";
                }
            }
            Response.Redirect("/Member/my_account.aspx");
        }
示例#2
0
        public void PrepaymentSubmit()
        {
            Guid   projectId = WEBRequest.GetFormGuid("ProjectId");
            string payPwd    = WEBRequest.GetFormString("TranPwd");
            Guid   userId    = WebUserAuth.UserId.Value;

            if (userId == null || userId == Guid.Empty)
            {
                this.PrintJson("-3", "对不起,您还未登录!");
                return;
            }

            if (GlobalUtils.IsOpenCGT)
            {
                TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney();
                reqMode.UserId = userId.ToString();
                List <Guid> listProject = new List <Guid>();
                listProject.Add(projectId);
                reqMode.ProjectIds = listProject;
                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.Prepayment);
                PrintJson("8888", url);
            }
            else
            {
                ProjectBLL bll      = new ProjectBLL();
                string     errorMsg = bll.PrepaymentSubmit(projectId, userId, payPwd);
                if (errorMsg != "")
                {
                    this.PrintJson("-2", errorMsg);
                    return;
                }

                //TuanDai.WXApiWeb.Common.SubscribeMsgHelper msghelper = new Common.SubscribeMsgHelper();
                //推送提前还款信息到App
                //msghelper.AsyncSubscribeUserToMsg(projectId);

                //向所有投资者发送短信通知用户提前还款
                //msghelper.SyncSendPhoneMsgToSubcribeUsers(projectId);
                SyncSendPhoneMsgToSubcribeUsers(projectId);

                SysLogHelper.WriteTraceLog("提前还款", "用户Id:" + userId.ToText() + " ProjectId:" + projectId.ToText());

                this.PrintJson("1", "");
                return;
            }
        }
示例#3
0
        private string CheckPwd(Guid userid, string content, CgtCallBackConfig.CgtCallBackType type)
        {
            CHECK_PASSWORD_Request request = new CHECK_PASSWORD_Request();
            CHECK_PASSWORD_Req_Td  reqTd   = new CHECK_PASSWORD_Req_Td();

            //ProductId|BuyQty|RepeatInvestType
            request.callbackUrl = CgtCallBackConfig.GetCgtCallBackUrl(type);

            request.platformUserNo = userid.ToString();
            request.userDevice     = userDevice.MOBILE;

            reqTd.applicationid           = 3;
            reqTd.businessid              = Guid.NewGuid();
            reqTd.content                 = content;
            reqTd.mCHECK_PASSWORD_Request = request;


            switch (type)
            {
            case CgtCallBackConfig.CgtCallBackType.WeInvest:
                string productName = Request["pname"];
                if (string.IsNullOrEmpty(productName))
                {
                    productName = "WE计划";
                }
                request.bizTypeDescription = "您正在购买" + GetWePlanTitle(productName);
                reqTd.typeid = 4;
                break;

            case CgtCallBackConfig.CgtCallBackType.TransferInvest:
                request.bizTypeDescription = "您正在购买债权转让";
                reqTd.typeid = 2;
                break;

            case CgtCallBackConfig.CgtCallBackType.ProjectInvest:
                string projectTypeName = Request["ptype"];
                int    projectTypeId;
                int.TryParse(projectTypeName, out projectTypeId);
                projectTypeName            = TypeIdToTitle(projectTypeId);
                request.bizTypeDescription = "您正在购买" + projectTypeName;
                reqTd.typeid = 2;
                break;

            case CgtCallBackConfig.CgtCallBackType.WeFqbPreExit:
                request.bizTypeDescription = "您正在进行提前退出申请";
                reqTd.typeid = 6;
                break;

            case CgtCallBackConfig.CgtCallBackType.EndProject:
                request.bizTypeDescription = "您正在进行结束发标";
                reqTd.typeid = 5;
                break;

            case CgtCallBackConfig.CgtCallBackType.ApplyZqzr:
                request.bizTypeDescription = "您正在进行债权转让申请";
                reqTd.typeid = 10;
                break;

            case CgtCallBackConfig.CgtCallBackType.Withdraw:
                request.bizTypeDescription = "您正在进行提现申请";
                reqTd.typeid = 8;
                break;

            case CgtCallBackConfig.CgtCallBackType.ModifyTradePwdStatus:
                bool isTenderNeedPayPassword = false;
                if (!string.IsNullOrEmpty(content))
                {
                    var req = JsonConvert.DeserializeObject <CgtCallbackUrl.Model.ModelRequest.UpdatePayPwdStatusRequest>(content);
                    isTenderNeedPayPassword = req.IsTenderNeedPayPassword;
                }
                request.bizTypeDescription = string.Format("您正在进行{0}交易密码", isTenderNeedPayPassword?"开启":"关闭");
                reqTd.typeid = 7;
                break;

            case CgtCallBackConfig.CgtCallBackType.Prepayment:
                request.bizTypeDescription = "您正在进行提前还款申请";
                reqTd.typeid = 3;
                break;

            case CgtCallBackConfig.CgtCallBackType.FTBPreExit:
                request.bizTypeDescription = "复投宝提前退出交易密码验证";
                reqTd.typeid = 11;
                break;
            }

            string rtn = UserClient.CHECK_PASSWORD_Req_Td(reqTd);

            return(rtn);
        }
示例#4
0
        //确认申请转让
        public void SubmitTransaction()
        {
            Guid subscribeId = Guid.Empty;

            Guid.TryParse(Context.Request["sid"], out subscribeId);
            int transferShares = 0;

            int.TryParse(Context.Request["shares"], out transferShares);
            decimal transferPrice = 0;

            decimal.TryParse(Context.Request["price"], out transferPrice);
            Guid userId = WebUserAuth.UserId.Value;

            string payPwd = Context.Request["ppwd"];

            payPwd = Tool.Encryption.MD5(payPwd);
            UserBasicInfoInfo userBasicEntity = new UserBLL().GetUserBasicInfoModelById(userId);

            if (userBasicEntity == null)
            {
                PrintJson("-31", "登录已过期或未登录");
                return;
            }
            if (!GlobalUtils.IsOpenCGT && !string.IsNullOrEmpty(payPwd) && userBasicEntity.PayPwd != payPwd)
            {
                PrintJson("-32", "交易密码错误");
                return;
            }
            if (string.IsNullOrEmpty(userBasicEntity.TelNo))
            {
                PrintJson("-33", "手机号码未认证");
                return;
            }

            string headImage = userBasicEntity.HeadImage;

            try
            {
                if (headImage.ToText().IsEmpty())
                {
                    //var whereParams = new Dapper.DynamicParameters();
                    Random rnd       = new Random();
                    int    rndNum    = rnd.Next(1, 28);
                    string rndminNum = rndNum.ToString();
                    if (rndNum < 10)
                    {
                        rndminNum = "0" + rndminNum;
                    }
                    headImage = GlobalUtils.TuanDaiURL + "/img/avatar/tdface/tdface" + rndminNum + ".jpg";
                    new TuanDai.PortalSystem.BLL.UserBLL().UpdateUserHeadImage(headImage, userId);
                    //string strSQL = string.Format(@"update UserBasicInfo set HeadImage=@HeadImage where id=@userId");
                    //whereParams.Add("@HeadImage", headImageURL);
                    //whereParams.Add("@userId", userId);
                    ////using (SqlConnection conn = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString))
                    ////{
                    ////    conn.Open();
                    ////    conn.Execute(strSQL, whereParams);
                    ////    conn.Close();
                    ////    conn.Dispose();
                    ////}
                    //PublicConn.ExecuteTD(PublicConn.DBWriteType.UserWrite, strSQL, ref whereParams);
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("申请转让,更新头像异常", "用户:" + userId + "异常:" + ex.Message);
            }

            if (GlobalUtils.IsOpenCGT && GlobalUtils.IsOpenCgtTrans)
            {
                var reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.SanBiaoTransactionRequest
                {
                    Channel        = "MOBILE",
                    UserId         = userId.ToString(),
                    subscribeId    = subscribeId,
                    transferPrice  = transferPrice,
                    transferShares = transferShares,
                    headImageURL   = headImage,
                    Version        = GlobalUtils.Version
                };

                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.ApplyZqzr);
                PrintJson("8888", url);
            }
            else
            {
                int    outputStatus = 0;
                string msg          = string.Empty;
                new TuanDai.PortalSystem.BLL.SubScriberansferBLL().ApplicationTransfer(subscribeId, string.Empty,
                                                                                       transferShares, transferPrice, userId, out outputStatus, out msg);

                if (outputStatus == 0)
                {
                    PrintJson("0", "申请转让失败");
                }
                else
                {
                    PrintJson(outputStatus.ToString(), msg);
                }
            }
        }
示例#5
0
        public void ApplyFTBTransfer()
        {
            Guid userid = WebUserAuth.UserId.Value;

            if (userid == Guid.Empty)
            {
                PrintJson("-99", "登陆超时");
            }
            TuanDai.PortalSystem.BLL.UserBLL             userbll = new TuanDai.PortalSystem.BLL.UserBLL();
            TuanDai.PortalSystem.Model.UserBasicInfoInfo model   = userbll.GetUserBasicInfoModelById(userid);
            if (model == null)
            {
                PrintJson("-98", "用户不存在");
            }
            if ((model.uStatus ?? 0) != 1)
            {
                PrintJson("-10", "用户已被冻结");
            }
            Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId");

            if (weOrderId == Guid.Empty)
            {
                PrintJson("-9", "We订单不存在");
            }
            decimal applyAmount = WEBRequest.GetFormString("ApplyAmount").ToDecimal(0);

            if (applyAmount <= 0)
            {
                PrintJson("-1", "申请的退出本金必须大于0");
            }
            if (applyAmount % 1 != 0)
            {
                PrintJson("-1", "请输入大于0的整数金额");
            }

            if (GlobalUtils.IsOpenCGT)
            {
                var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyFTBTransferRequest
                {
                    WeOrderId      = weOrderId,
                    TransferAmount = applyAmount
                };

                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.FTBPreExit);
                PrintJson("8888", url);
            }
            else
            {
                //验证交易密码
                var bll         = new UserSettingBLL();
                var usersetting = bll.GetUserSettingInfo(userid);
                if (usersetting != null)
                {
                    #region
                    if (usersetting.PayPwdErrorDate.HasValue)
                    {
                        DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd"));
                        DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                        if (date1 == date2 && usersetting.PayPwdErrorCount >= 5)
                        {
                            PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作");
                        }
                        if (date1 != date2 && usersetting.PayPwdErrorCount > 1)
                        {
                            usersetting.PayPwdErrorCount = 0;
                            usersetting.PayPwdErrorDate  = null;
                        }
                    }
                    string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]);
                    if (PayPwd != model.PayPwd)
                    {
                        //记录登录错误次数
                        if (usersetting.PayPwdErrorCount == null)
                        {
                            usersetting.PayPwdErrorCount = 0;
                        }
                        usersetting.PayPwdErrorCount += 1;
                        usersetting.PayPwdErrorDate   = DateTime.Now;
                        //db.SaveChanges();
                        bll.UpdateUserSettingInfo(usersetting);
                        if (usersetting.PayPwdErrorCount == 5)
                        {
                            PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作");
                        }
                        else
                        {
                            PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会");
                        }
                    }
                    else
                    {
                        //清除错误记录
                        usersetting.PayPwdErrorCount = 0;
                        usersetting.PayPwdErrorDate  = null;
                        bll.UpdateUserSettingInfo(usersetting);
                    }
                    #endregion
                }

                int    status   = 0;
                string strError = "";
                TuanDai.PortalSystem.BLL.WeFTBBLL webll = new TuanDai.PortalSystem.BLL.WeFTBBLL();
                webll.ApplyFTBRansom(weOrderId, applyAmount, out status, out strError);
                PrintJson(status.ToString(), strError);
            }
        }
示例#6
0
        /// <summary>
        /// We计划分期宝申请赎回
        /// </summary>
        public void ApplyWeFqbTransfer()
        {
            Guid userid = WebUserAuth.UserId.Value;

            if (userid == Guid.Empty)
            {
                PrintJson("-99", "登陆超时");
            }
            TuanDai.PortalSystem.BLL.UserBLL             userbll = new TuanDai.PortalSystem.BLL.UserBLL();
            TuanDai.PortalSystem.Model.UserBasicInfoInfo model   = userbll.GetUserBasicInfoModelById(userid);
            if (model == null)
            {
                PrintJson("-98", "用户不存在");
            }
            if ((model.uStatus ?? 0) != 1)
            {
                PrintJson("-10", "用户已被冻结");
            }
            Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId");

            if (weOrderId == Guid.Empty)
            {
                PrintJson("-9", "We订单不存在");
            }
            if (GlobalUtils.IsOpenCGT)
            {
                var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyWeFQBTransferRequest
                {
                    WeOrderId = weOrderId
                };

                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.WeFqbPreExit);
                PrintJson("8888", url);
            }
            else
            {
                //验证交易密码
                var bll         = new UserSettingBLL();
                var usersetting = bll.GetUserSettingInfo(userid);
                if (usersetting != null)
                {
                    if (usersetting.PayPwdErrorDate.HasValue)
                    {
                        DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd"));
                        DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                        if (date1 == date2 && usersetting.PayPwdErrorCount >= 5)
                        {
                            PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作");
                        }
                        if (date1 != date2 && usersetting.PayPwdErrorCount > 1)
                        {
                            usersetting.PayPwdErrorCount = 0;
                            usersetting.PayPwdErrorDate  = null;
                        }
                    }
                    string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]);
                    if (PayPwd != model.PayPwd)
                    {
                        //记录登录错误次数
                        if (usersetting.PayPwdErrorCount == null)
                        {
                            usersetting.PayPwdErrorCount = 0;
                        }
                        usersetting.PayPwdErrorCount += 1;
                        usersetting.PayPwdErrorDate   = DateTime.Now;
                        //db.SaveChanges();
                        bll.UpdateUserSettingInfo(usersetting);
                        if (usersetting.PayPwdErrorCount == 5)
                        {
                            PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作");
                        }
                        else
                        {
                            PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会");
                        }
                    }
                    else
                    {
                        //清除错误记录
                        usersetting.PayPwdErrorCount = 0;
                        usersetting.PayPwdErrorDate  = null;
                        //db.SaveChanges();
                        bll.UpdateUserSettingInfo(usersetting);
                    }
                }
                int status = 0;
                TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL();
                webll.ApplyWeFqbRansom(weOrderId, out status);
                if (status == 1)
                {
                    PrintJson("1", "申请转让成功");
                }
                else
                {
                    string errMsg = "";
                    switch (status)
                    {
                    case 0:
                        errMsg = "系统异常";
                        break;

                    case 2:
                        errMsg = "不是We计划分期宝";
                        break;

                    case 3:
                        errMsg = "回款中状态不允许赎回";
                        break;

                    case 4:
                        errMsg = "持有时间必须超过3个月";
                        break;

                    case 5:
                        errMsg = "只有投标中的We计划才能转让";
                        break;
                    }
                    PrintJson("0", errMsg);
                }
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userid = WebUserAuth.UserId.Value;
            //if (GetBankInfo(userid, 2) == 1)
            //{
            //    //if (bankmodel.Status==2)
            //    //{
            //    //Response.Write("您好,银行卡在审核中不允许充值!");
            //    ClientScript.RegisterStartupScript(this.GetType(), "ss",
            //        "<script>ShowMsg('您好,银行卡在审核中不允许充值!','1','确定');</script>");
            //    return;
            //    //}
            //}
            decimal Amount    = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0);
            decimal tmpAmount = Math.Floor(Amount * 100) / 100;

            if (tmpAmount != Amount)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('充值金额最多只能2位小数,如106.32!','1','确定');</script>");
                return;
            }
            TuanDai.PortalSystem.Model.WebSettingInfo rechargeSet =
                new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal minRecharge = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < minRecharge)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('单次充值最少" + minRecharge.ToString("N2") + "元!','1','确定');</script>");
                return;
            }
            if (Amount > 500000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('单次充值不能超过50万!','1','确定');</script>");
                return;
            }

            var cgtMode = new QueryClient().GetUserByPlatformUserNo(userid);

            if (cgtMode == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('存管通未开通,不能进行充值!','1','确定');</script>");
                return;
            }
            if (!cgtMode.isActivate)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('存管通未激活,不能进行充值!','1','确定');</script>");
                return;
            }

            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>");
                return;
            }

            string err        = string.Empty;
            bool   isRecharge = new CgtCheckBLL().GetUserCgtIsOper(userid, "recharge", ref err);

            if (!isRecharge)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('" + err + "','1','确定');</script>");
                return;
            }
            //获取银行卡号
            string bankNo  = Request["bankno"];
            string outCode = string.Empty;

            if (!string.IsNullOrEmpty(bankNo))
            {
                try
                {
                    bankNo = Tool.DESC.Decrypt(bankNo);
                }
                catch (Exception)
                {
                    bankNo = null;
                }
            }

            BankFromJavaService bankJavaService = new BankFromJavaService();

            if (GlobalUtils.IsBankService)
            {
                var bankInfoFromJava = bankJavaService.GetBankInfo(userid, ServiceType.NotTuomin);
                if (bankInfoFromJava != null && bankInfoFromJava.respData != null)
                {
                    bankNo  = bankInfoFromJava.respData.bankNo;
                    outCode = bankInfoFromJava.respData.bankCode;
                }
            }
            else
            {
                var userInfo = new PortalSystem.BLL.UserBLL().GetUserBasicInfoModelById(userid);
                if (userInfo == null || string.IsNullOrEmpty(userInfo.BankAccountNo))
                {
                    var bankInfo = GlobalUtils.GetBankInfo(userid);
                    bankNo = bankInfo.BankNo;
                }
                else
                {
                    bankNo = userInfo.BankAccountNo;
                }
            }

            string userIP = Tool.WebFormHandler.GetIP();

            if (!GlobalUtils.IsBankService)
            {
                var sss = TuanDai.Payment.Client.BankInfo.GetPayBankInfo(userid);

                TuanDai.Payment.Models.PayRoute.RouteInfo bank = new TuanDai.Payment.Client.Recharge().GetCgtRechargeInfo(userid, sss.BankNo);
                int Sel = bank.Sel;

                int    outStatus = 0;
                string bankcode  = "";
                if (Request.Params["bankcode"] != null)
                {
                    bankcode = Request.Params["bankcode"];
                }


                var paramData = new Dapper.DynamicParameters();
                paramData.Add("@userid", userid);
                paramData.Add("@type", Sel);
                paramData.Add("@amount", Amount);
                paramData.Add("@orderNo", orderNo);
                paramData.Add("@backcode", bankcode);
                paramData.Add("@clientIp", userIP);
                paramData.Add("@from", "5");
                if (bank.RouteId.IsEmpty())
                {
                    paramData.Add("@RouteId", null);
                }
                else
                {
                    paramData.Add("@RouteId", bank.RouteId);
                }
                paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
                paramData.Add("@cmorderNo", "");
                PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "p_cgt_AccountRechargeInit", ref paramData, CommandType.StoredProcedure);
                outStatus = paramData.Get <int>("@outStatus");

                int result = outStatus;
                if (result > 0)
                {
                    lock (lockstatus)
                    {
                        var isCallBackPayment =
                            System.Configuration.ConfigurationManager.AppSettings["IsCallBackPayment"];
                        var    paymentUrl  = System.Configuration.ConfigurationManager.AppSettings["PaymentUrl"];
                        string callBackUrl = paymentUrl + "/PaymentPlatform/H5/commonCallBack.aspx";
                        if (isCallBackPayment == "0")
                        {
                            callBackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge);
                        }
                        var recharInfo = new Payment.Client.Recharge().GetCgtRechargeInfo(userid, bankNo);
                        var url        = CunGuanTong.Client.FundClient.RECHARGE_Req(new CunGuanTong.Model.RECHARGE_Request
                        {
                            rechargeWay      = rechargeWay.SWIFT,
                            requestNo        = orderNo,
                            amount           = Amount,
                            bankcode         = recharInfo.OutCode,
                            callbackMode     = "DIRECT_CALLBACK",
                            platformUserNo   = userid.ToString(),
                            expectPayCompany = recharInfo.CgtPayCompany,
                            //callbackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge),
                            callbackUrl = callBackUrl,
                            userDevice  = CunGuanTong.Model.userDevice.MOBILE
                        });

                        if (string.IsNullOrEmpty(url))
                        {
                            if (Request.UrlReferrer != null)
                            {
                                url = Request.UrlReferrer.ToString();
                            }
                            else
                            {
                                url = GlobalUtils.WebURL;
                            }
                        }
                        Response.Redirect(url);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,充值提交失败请重试!','1','确定');</script>");
                }
            }
            else
            {  //走Java银行卡服务
                string retUrl = bankJavaService.GetCgtRechargeUrl(userid, bankNo, Amount, userIP, outCode);
                if (!string.IsNullOrEmpty(retUrl))
                {
                    Response.Redirect(retUrl);
                }
            }
        }
示例#8
0
        public void CheckPayPwd()
        {
            Guid userid = WebUserAuth.UserId.Value;

            if (userid == Guid.Empty)
            {
                PrintJson("-99", "登录已失效");
            }
            string msg          = string.Empty;
            var    isWithdrawal = new CgtCheckBLL().GetUserCgtIsOper(userid, "tixian", ref msg);

            if (!isWithdrawal)
            {
                PrintJson("-199", msg + ",不允许提现");
                return;
            }

            string  amountStr       = Context.Request.Form["amount"];
            string  couponAmountStr = Context.Request.Form["couponAmount"];
            decimal amount          = 0m;
            decimal couponAmount    = 0m;

            if (!string.IsNullOrEmpty(amountStr))
            {
                amount = Convert.ToDecimal(amountStr);
            }
            if (!string.IsNullOrEmpty(couponAmountStr))
            {
                couponAmount = Convert.ToDecimal(couponAmountStr);
            }
            string userPrizeId = Context.Request.Form["userPrizeId"];
            Guid   couponId    = new Guid();

            if (!string.IsNullOrEmpty(userPrizeId))
            {
                couponId = Guid.Parse(userPrizeId);//优惠券Id
            }
            //可提现金额
            decimal aviMoney = new UserBLL().GetDrawAviAmount(userid);

            if (amount > aviMoney)
            {
                PrintJson("-1", "申请提现金额大于可用金额");
                return;
            }

            string withdrawNo = string.Empty;

            if (GlobalUtils.IsBankService)
            {
                WXResponsePublicInfo <WXResponseWithdrawInit> init =
                    new BankFromJavaService().WithdrawalInit(new WXRequestPublicInfo <WXRequestWithdrawInit>
                {
                    serverName = TdConfig.ApplicationName,
                    reqData    = new WXRequestWithdrawInit
                    {
                        amount       = amount,
                        couponId     = couponId,
                        couponAmount = couponAmount,
                        fundType     = "USER",
                        userId       = userid,
                        withdrawType = "GATEWAY"
                    }
                });
                if (init != null)
                {
                    withdrawNo = init.respData.withdrawNo;
                }
                else
                {
                    PrintJson("-1", "生成提现申请出错");
                    return;
                }
            }
            else
            {
                string err = "";
                WithdrawResponseModel resmodel = TuanDai.Payment.Client.Withdraw.ApplyWithdraw(new WithdrawRequestModel
                {
                    Amount       = amount,
                    CouponAmount = couponAmount,
                    CouponId     = couponId,
                    FundType     = 0,
                    UserId       = userid,
                    WithdrawType = 1//1:存管通,2:定期
                }, ref err);

                if (resmodel == null)
                {
                    TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "生成提现申请出错", "", err);
                    PrintJson("-1", "生成提现申请出错");
                    return;
                }
                if (resmodel.ReturnCode != 1)
                {
                    TuanDai.LogSystem.LogClient.LogClients.ErrorLog("WXTouch", "TuanDai.Payment.Client.Withdraw.ApplyWithdraw", "提现申请错误", resmodel.ReturnMessage);
                    PrintJson("-1", resmodel.ReturnMessage);
                }

                withdrawNo = resmodel.WithdrawNo;
            }


            //申请提现金额
            //decimal handingcharge= decimal.Parse(resmodel.HandingCharge.ToString());
            //if ((aviMoney - amount - handingcharge) < 0)
            //{
            //    amount = amount - handingcharge;
            //}
            string strSQL = "SELECT TOP 1 * FROM AppWithdrewFund WHERE UserId=@UserId and WithdrawNo=@WithdrawNo";

            var dyParams = new Dapper.DynamicParameters();

            dyParams.Add("@UserId", userid);
            dyParams.Add("@WithdrawNo", withdrawNo);
            WXAppWithdrewFund fundInfo = TuanDai.DB.TuanDaiDB.QuerySingleOrDefault <WXAppWithdrewFund>(TdConfig.ApplicationName, TdConfig.DBRealRead, strSQL, ref dyParams);

            if (fundInfo == null)
            {
                PrintJson("-1", "获取提现金额失败");
                return;
            }
            var    isCallBackPayment = System.Configuration.ConfigurationManager.AppSettings["IsCallBackPayment"];
            var    paymentUrl        = System.Configuration.ConfigurationManager.AppSettings["PaymentUrl"];
            string callBackUrl       = paymentUrl + "/PaymentPlatform/H5/commonCallBack.aspx";

            if (isCallBackPayment != "1")
            {
                callBackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Withdraw);
            }
            TuanDai.CunGuanTong.Model.WITHDRAW_Request info = new TuanDai.CunGuanTong.Model.WITHDRAW_Request
            {
                callbackUrl    = callBackUrl,
                platformUserNo = userid.ToString(),
                userDevice     = TuanDai.CunGuanTong.Model.userDevice.MOBILE,
                amount         = decimal.Parse(fundInfo.ActualWithdrawDeposit.Value.ToString("0.00")),
                commission     = fundInfo.HandingCharge.HasValue ? decimal.Parse(fundInfo.HandingCharge.Value.ToString("0.00")) : decimal.Zero, //,//提现手续费
                requestNo      = withdrawNo                                                                                                     //提现订单流水号
            };
            string responseStr = TuanDai.CunGuanTong.Client.FundClient.WITHDRAW_Req(info);

            PrintJson("1", responseStr);
        }