public PartialViewResult AuditIt(AuditModel am) { ViewData["sysBank"] = GetSysBank(); if (ModelState.IsValid && IsTranPwd(am.code)) { var r = db.BankRecords.Where(a => a.Id == am.BrId).FirstOrDefault(); if (r == null) { ViewBag.msg = "无此编号的记录"; return(PartialView(am)); } if (r.IsApproved == true) { ViewBag.msg = "已审核"; return(PartialView(am)); } // if (r.BankRecordType == BankRecordType.提现 && r.coin == "BTC") { } else if (r.BankRecordType == BankRecordType.充值 && r.coin == "BTC") { if (!rech.BtcRecharge(r.AppUserName, r.Num, r.Address)) { ViewBag.msg = "不符合审核条件"; return(PartialView(am)); } } var sa = AddSysBankRecord(am); r.IsApproved = true; r.AuditTime = DateTime.Now; r.ActualDelta = am.ActualDelta; r.ApproveDesc = am.Desc; r.ApprovedResult = am.IsApproved; r.SysRecord = sa; var t = db.SaveChanges() > 0; if (!t) { ViewBag.msg = "审核失败"; return(PartialView(am)); } else { var u = MvcApplication.OptionService.Model.Traders.Where(a => a.Name == r.AppUserName).FirstOrDefault(); if (u != null) { if (r.ApprovedResult.Value)//审核通过 { TraderService.OperateAccount( u, r.ActualDelta, r.BankRecordType == BankRecordType.提现 && r.coin == "CNY" ? AccountChangeType.CNY提现 : (r.BankRecordType == BankRecordType.充值 && r.coin == "CNY" ? AccountChangeType.CNY充值 : (r.BankRecordType == BankRecordType.提现 && r.coin == "BTC" ? AccountChangeType.BTC提现 : AccountChangeType.BTC充值)), User.Identity.Name, null ); var user = db.Users.Where(a => a.UserName == u.Name).FirstOrDefault(); if (user != null) { string str = string.Format("您的比权网账户于{0}发生了一笔{2}操作,目前已到账,到账金额为 {1} 元,请注意查收。【比权网】", r.AuditTime, am.ActualDelta, r.BankRecordType.ToString()); qes.SendMassage2(user.PhoneNumber.ToString(), str); } } else //审核不通过 { if (r.BankRecordType == BankRecordType.提现 && r.coin == "CNY") { TraderService.OperateAccount(u, r.Delta, AccountChangeType.现金解冻, "system", null); } } } ViewBag.msg = "审核成功"; return(PartialView()); } } return(PartialView(am)); }