public string CreateWithdrawApply(CreateWithdrawApplyParam param)
 {
     if (ModelState.IsValid)
     {
         User   userInfo         = SessionTool.Get <User>("user");
         string withdrawPassword = withdraw.GetWithdrawPassword((int)userInfo.No);
         if (param.WithdrawPassword != withdrawPassword)
         {
             return("提现密码错误");
         }
         UserBLL      userBLL             = new UserBLL();
         UserApiModel userApiModel1       = userBLL.GetUserInfo(Convert.ToInt32((int)userInfo.No));
         decimal      allowWithdrawAmount = userApiModel1.WithdrawAmount;
         if (param.ApplyWithwrawAmount <= allowWithdrawAmount)
         {
             WithdrawApplyApiModel model = new WithdrawApplyApiModel()
             {
                 Amount = allowWithdrawAmount,
                 ApplyWithwrawAmount = param.ApplyWithwrawAmount,
                 UserNo      = (int)userInfo.No,
                 ZFBAccount  = param.ZFBAccount,
                 SpareField1 = param.SpareField1
             };
             if (withdrawApply.Create(model) > 0)
             {
                 return("成功");
             }
             else
             {
                 return("失败");
             }
         }
         else
         {
             return("提现金额不可大于总金额,总金额为:" + allowWithdrawAmount);
         }
     }
     else
     {
         return("提现金额、提现密码和支付宝账号不可为空");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建提现申请
        /// </summary>
        /// <returns></returns>
        public int Create(WithdrawApplyApiModel applyModel)
        {
            if (applyModel == null)
            {
                return(0);
            }
            if (applyModel.UserNo <= 0)
            {
                return(0);
            }
            LoanMarketWithdrawApply model = new LoanMarketWithdrawApply();

            model.Id     = GuidTool.GenerateKey();
            model.Amount = applyModel.Amount;
            model.ApplyWithwrawAmount = applyModel.ApplyWithwrawAmount;
            model.CreateTime          = DateTime.Now;
            model.Status     = "提交申请";
            model.UpdateTime = DateTime.Now;
            model.UserNo     = applyModel.UserNo;
            UserBLL      userBLL  = new UserBLL();
            UserApiModel userInfo = userBLL.GetUserInfo(applyModel.UserNo);

            model.UserNickName = userInfo.NickName;
            model.UserRealName = userInfo.RealName;
            model.ZFBAccount   = applyModel.ZFBAccount;
            int          res = withdrawApply.Create(model);
            UserApiModel updateUserWithdrawAmount = new UserApiModel()
            {
                No             = applyModel.UserNo,
                WithdrawAmount = applyModel.Amount - applyModel.ApplyWithwrawAmount
            };

            if (userBLL.UpdateWithdrawAmount(updateUserWithdrawAmount) > 0)
            {
                return(res);
            }
            else
            {
                return(0);
            }
        }