public ActionResult WritePost([FromBody] PostInfo postInfo)
 {
     try
     {
         if (postInfo == null)
         {
             return(Ok(new
             {
                 mark = "2",
                 msg = "请求数据不能为空!"
             }));
         }
         if (string.IsNullOrEmpty(postInfo.PostTitle))
         {
             return(Ok(new
             {
                 mark = "2",
                 msg = "标题不能为空!"
             }));
         }
         if (postInfo.SecondCategory.SecondCategoryId <= 0)
         {
             return(Ok(new
             {
                 mark = "2",
                 msg = "分类为空!"
             }));
         }
         if (string.IsNullOrEmpty(HtmlFillter.ReplaceHtmlToBlankExCludetImg(postInfo.PostContent.Trim()).Trim()))
         {
             return(Ok(new
             {
                 mark = "2",
                 msg = "内容为空!"
             }));
         }
         var headerStr = Request.Headers["Authorization"];
         var jwtHelper = new JWTHelper(_configuration);
         var user      = new UserInfo
         {
             UserId = jwtHelper.GetJWTUserData(headerStr)
         };
         postInfo.Author     = user;
         postInfo.Status     = 1;
         postInfo.CreateDate = DateTime.Now;
         postInfo.UpdateDate = DateTime.Now;
         // 过滤 html 后的内容
         //var pc = HtmlFillter.ReplaceHtmlToBlank(postInfo.PostContent);
         //描述
         //postInfo.Description = pc.Length > 50 ? pc.Substring(0, 50) + " ..." : pc;
         postInfo.Description = HtmlFillter.ReplaceHtmlToBlank(postInfo.PostContent);
         var result = _postService.AddPostInfo(postInfo);
         if (result > 0)
         {
             return(Ok(new
             {
                 mark = "1",
                 postId = result,
                 msg = "发布成功!"
             }));
         }
         return(Ok(new
         {
             mark = "2",
             msg = "处理失败!"
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new
         {
             mark = "2",
             msg = ex.Message
         }));
     }
 }