public ActionResult Pass(int id) { var msg = LeaveMessageService.GetById(id); msg.Status = Status.Published; bool b = LeaveMessageService.SaveChanges() > 0; #if !DEBUG var pid = msg.ParentId == 0 ? msg.Id : LeaveMessageService.GetParentMessageIdByChildId(id); var content = new Template(System.IO.File.ReadAllText(Path.Combine(HostEnvironment.WebRootPath, "template", "notify.html"))).Set("time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")).Set("nickname", msg.NickName).Set("content", msg.Content); var emails = LeaveMessageService.GetSelfAndAllChildrenMessagesByParentId(pid).Select(c => c.Email).Except(new List <string> { msg.Email, CurrentUser.Email }).ToHashSet(); var link = Url.Action("Index", "Msg", new { cid = pid }, Request.Scheme); foreach (var s in emails) { BackgroundJob.Enqueue(() => CommonHelper.SendMail($"{Request.Host}{CommonHelper.SystemSettings["Title"]} 留言回复:", content.Set("link", link).Render(false), s)); } #endif return(ResultData(null, b, b ? "审核通过!" : "审核失败!")); }