/// <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); } }
/// <summary> /// 创建提现申请 /// </summary> /// <param name="apply"></param> /// <returns></returns> public int Create(LoanMarketWithdrawApply apply) { db.LoanMarketWithdrawApply.Add(apply); return(db.SaveChanges()); }