Пример #1
0
        private void DenyBlog(Blog b, string auditor, bool sendmsg, string reason = "")
        {
            bool amend = b.isApproved == true;

            if (b.isApproved != false)
            {
                b.isApproved = false;
                TriggerDenyBlog(b);
                var message = new StringBuilder(reason);
                if (message.Length == 0)
                {
                    message.AppendFormat("您的投稿 {0} 未通过审核。", WebUtility.HtmlEncode(b.BlogTitle));
                }
                message.AppendFormat(" <br>投稿地址:<br><a href='{0}'>{0}</a>", Url.Action("Details", "Blog", new { id = b.BlogID }));
                _adminUtil.ArchiveAudit(b, auditor, BlogAudit.Action.Deny, amend, reason);
                _adminUtil.log(auditor, "unapprove", b.BlogID.ToString(), reason);
                if (sendmsg)
                {
                    _msgUtil.AddMsg(auditor, b.Author, "审核通知", message.ToString(), auditor == "admin");
                }
            }
        }
Пример #2
0
 public ActionResult Report(int?id, ItemType itemType, int?postid, string MsgContent, string type)
 {
     if (id.HasValue)
     {
         string hashtag = null;
         if (postid.HasValue)
         {
             hashtag = "#listpost" + postid;
         }
         string controller = itemType == ItemType.Topic ? "Topic" : "Blog";
         string url        = Url.Action("Details", controller, new { id = id }) + hashtag;
         string content    = System.Net.WebUtility.HtmlEncode(MsgContent) + "<br>地址:<br><a href='" + url + "'>" + url + "</a>";
         if (type == "rpt-author")
         {
             string author;
             if (itemType == ItemType.Topic)
             {
                 var t = _db.Topics.Find(id.Value);
                 author = t?.Author;
             }
             else
             {
                 var blog = _db.Blogs.Find(id.Value);
                 author = blog?.Author;
             }
             if (author == null)
             {
                 return(NotFound());
             }
             _msgUtil.AddMsg(User.Identity.Name, author, "汇报投稿问题", content);
         }
         else
         {
             _blogUtil.AddBlogPost(-1, User.Identity.Name, content);
         }
         return(Json(new { msg = "已成功汇报" }));
     }
     return(NotFound());
 }