Пример #1
0
        protected int IsRegHasOneMonth = 1;                    //注册是否满一个月

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("/pages/downloadGuide.aspx", true);
            if (!this.IsPostBack)
            {
                var userId = WebUserAuth.UserId.Value;
                if (userId != null && userId != Guid.Empty)
                {
                    GetIsProjectFreePaidUser(userId);
                    GetUserVipMsg(userId);

                    var userBll = new UserBLL();
                    var user    = userBll.GetUserBasicInfoModelById(userId);
                    //2016.5.4号注册的加条件: 注册满1个月才能发资产标,即1个月零1天才能发资产标,一个月以内进入发标页面后弹框提示“您好,注册满一个月后才能发布资产标”
                    if (user.AddDate >= DateTime.Parse("2016-05-04 12:00"))
                    {
                        IsRegHasOneMonth = user.AddDate.Value.AddMonths(1) < DateTime.Now ? 1 : 0;
                    }
                    this.options = new List <Tuple <int, decimal, decimal, int, string> >();
                    var result1 = WXInvest.CheckNetIssueConditions(userId);
                    if (result1.Success)
                    {
                        var fund    = userBll.GetUserFundAccountInfo(userId);
                        var setting = WXInvest.GetJingSetting();
                        tuandaiFeeRate = user.Level == 1 ? setting.Param1Value.ToDecimal(0) : setting.Param2Value.ToDecimal(0);
                        creditAmount   = WXInvest.GetUserJingAvailableAmount(user, fund, setting, out maxDeadline);

                        string text = string.Format("资产标(借款额度{0}元)", ToolStatus.ConvertLowerMoney(creditAmount));
                        this.options.Add(new Tuple <int, decimal, decimal, int, string>(6, creditAmount, tuandaiFeeRate, maxDeadline, text));
                        this.deadLineDesc = string.Format("还款期限最高{0}个月", maxDeadline);
                    }

                    //资产标短期标配置
                    WebSettingBLL  setbll      = new WebSettingBLL();
                    WebSettingInfo deadlineDay = setbll.GetWebSettingInfo("78A758ED-6D5C-4991-A804-6601E50960AD");
                    minDeadlineDay = Tool.SafeConvert.ToInt32(deadlineDay.Param1Value, 15);
                    maxDeadlineDay = Tool.SafeConvert.ToInt32(deadlineDay.Param2Value, 29);
                    endDeadlineDay = deadlineDay.Param3Value.ToDateTime(DateTime.MaxValue);
                    //var result2 = WXInvest.CheckStockIssueConditions(userId);
                    //if (result2.Success)
                    //{
                    //    var setting = WXInvest.GetStockSetting();
                    //    var tuandaiFeeRate = user.Level == 1 ? setting.Param1Value.ToDecimal(0) : setting.Param2Value.ToDecimal(0);
                    //    var amount = user.aviCreditGrantingAmount ?? 0;
                    //    var text = string.Format("资产标-综合授信(授信额度{0}元)", ToolStatus.ConvertLowerMoney(amount));
                    //    this.options.Add(new Tuple<int, decimal, decimal, int, string>(7, amount, tuandaiFeeRate, 24, text));
                    //    if (!result1.Success) this.deadLineDesc = string.Format("还款期限最高{0}个月", 24);
                    //}
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 提交发标请求.
        /// </summary>
        public void Submit()
        {
            PrintJson("-1", "触屏版不支持发资产标,请前往PC或APP");
            return;

            //将用户提交的请求信息转换成视图模型.
            var model = WXInvest.ConvertTo <ProjectViewModel>(HttpContext.Current.Request, HttpMethod.POST);

            if (model.Unit > 1000)
            {
                this.PrintJson("-1", "最小单位不能大于1000");
            }
            if (model.InterestRate.HasValue)
            {
                int totalLength = model.InterestRate.ToString().Length;                                                                 //总长度
                int floatLength = totalLength - 1 - Math.Floor(model.InterestRate.Value).ToString().Length;                             //小数位数
                int dataLength  = int.Parse(new WebSettingBLL().GetWebSettingInfo("3F902315-6986-44FF-9F00-9D420C07FCDA").Param1Value); //数据库配置位数
                if (floatLength > dataLength)
                {
                    this.PrintJson("-1", "利率的小数位数不能超过" + dataLength + "位");
                }
            }

            if (model.Repayment != 1 && model.Repayment != 2)
            {
                this.PrintJson("-1", "还款方式不对");
            }
            string  PayPwd = Tool.Encryption.MD5(Context.Request["PayPwd"]);
            decimal rate   = decimal.Parse(Context.Request["rate"]);

            //校验用户信息.
            var userId  = WebUserAuth.UserId.Value;
            var userbll = new UserBLL();
            var user    = userbll.GetUserBasicInfoModelById(userId);

            if (user == null)
            {
                this.PrintJson("-2", "用户不存在");
            }

            if (string.IsNullOrEmpty(user.PayPwd) || user.PayPwd == user.Pwd)
            {
                this.PrintJson("-4", "请先到安全中心设置交易密码");
            }

            //DB.UserSetting usersetting = db.UserSettings.FirstOrDefault(p=>p.UserId==userId);
            //modify by ShellBen 2015-12-26
            UserSettingDAL  usDal       = new UserSettingDAL();
            UserSettingInfo usersetting = usDal.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)
                    {
                        this.PrintJson("-5", "交易密码已错误5次,请24小时后再进行此操作");
                    }
                    if (date1 != date2 && usersetting.PayPwdErrorCount > 1)
                    {
                        usersetting.PayPwdErrorCount = 0;
                        usersetting.PayPwdErrorDate  = null;
                    }
                }
            }
            else
            {
                //usersetting = new DB.UserSetting();
                usersetting        = new UserSettingInfo();
                usersetting.Id     = Guid.NewGuid();
                usersetting.UserId = userId;
                usersetting.IsTenderNeedPayPassword = false;
                usersetting.IsAllowChangePwd        = true;
                usersetting.PayPwdErrorCount        = 0;
                usersetting.PayPwdErrorDate         = null;
                //db.UserSettings.AddObject(usersetting);
                //db.SaveChanges();
                usDal.AddUserSettingInfo(usersetting);
            }

            if (user.PayPwd != PayPwd)
            {
                //记录登录错误次数
                if (usersetting.PayPwdErrorCount == null)
                {
                    usersetting.PayPwdErrorCount = 0;
                }
                usersetting.PayPwdErrorCount += 1;
                usersetting.PayPwdErrorDate   = DateTime.Now;
                //db.SaveChanges();
                usDal.UpdateUserSettingInfo(usersetting);
                if (usersetting.PayPwdErrorCount >= 5)
                {
                    this.PrintJson("-6", "今日交易密码已错误5次,请24小时后再进行此操作!");
                }
                else
                {
                    this.PrintJson("-7", "交易密码错误,今日还有" + (5 - usersetting.PayPwdErrorCount) + "次机会,错误5次将锁定24小时!");
                }
                return;
            }
            else
            {
                //清除错误记录
                usersetting.PayPwdErrorCount = 0;
                usersetting.PayPwdErrorDate  = null;
                //db.SaveChanges();
                usDal.UpdateUserSettingInfo(usersetting);
            }

            //校验项目信息.
            var result = WXInvest.CheckProjectInfo(model, user);

            if (!result.Success)
            {
                this.PrintJson(result.Code.ToString(), result.Message);
            }

            //生成项目流水号.
            var handler   = new NoHandler();
            var projectNo = handler.ProjectNo();

            if (projectNo == "0")
            {
                this.PrintJson("-3", "项目流水号生成出错");
            }

            //保存项目信息.
            var setting = result.GetParameter <WebSettingInfo>("Setting");

            result = result + WXInvest.SaveProject(model, user, setting, projectNo, rate);
            if (!result.Success)
            {
                this.PrintJson(result.Code.ToString(), result.Message);
            }

            this.PrintJson("1", "提交成功");
        }
Пример #3
0
        /// <summary>
        /// 检测用户是否可以发标.
        /// </summary>
        public void Check()
        {
            var result = WXInvest.CheckIssueConditions(WebUserAuth.UserId.Value);

            this.PrintJson(result);
        }