Example #1
0
        /// <summary>
        /// We计划分期宝取消赎回
        /// </summary>
        public void CancleWeFqbTransfer()
        {
            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", "用户不存在");
            }
            Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId");

            if (weOrderId == Guid.Empty)
            {
                PrintJson("-9", "We订单不存在");
            }
            int status = 0;

            TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL();
            webll.RevokeWeFqbRansom(weOrderId, out status);
            if (status == 1)
            {
                PrintJson("1", "撤销转让成功");
            }
            else
            {
                string errMsg = "";
                switch (status)
                {
                case 0:
                    errMsg = "系统异常";
                    break;

                case 2:
                    errMsg = "不在赎回状态";
                    break;

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

                case 4:
                    errMsg = "债权已有人承接,不能撤销";
                    break;
                }
                PrintJson("0", errMsg);
            }
        }
Example #2
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);
                }
            }
        }