public bool editPost(string postid, string username, string password, Post post, bool publish) { int uid = ValidateUser(username, password); if (uid < 1) { throw new XmlRpcFaultException(0, "用户不存在"); } Entity.SpacePostInfo spacepostinfo = Discuz.Space.Provider.BlogProvider.GetSpacepostsInfo(DbProvider.GetInstance().GetSpacePost(int.Parse(postid))); spacepostinfo.Title = ForumUtils.BanWordFilter(post.title); spacepostinfo.Content = ForumUtils.BanWordFilter(post.description); spacepostinfo.Category = Space.Spaces.GetCategoryIds(post.categories, uid); spacepostinfo.PostUpDateTime = DateTime.Now; bool success; try { success = DbProvider.GetInstance().SaveSpacePost(spacepostinfo); } catch (Exception ex) { throw new XmlRpcFaultException(0, ex.ToString()); } return(success); }
/// <summary> /// 转换日志 /// </summary> /// <param name="postinfo"></param> /// <param name="uid"></param> /// <returns></returns> private Post ConvertPost(Entity.SpacePostInfo postinfo, int uid) { Post post = new Post(); post.postid = postinfo.Postid; post.title = postinfo.Title; post.description = postinfo.Content; post.categories = Space.Spaces.GetCategories(postinfo.Category, uid); return(post); }
public Post getPost(string postid, string username, string password) { int uid = ValidateUser(username, password); if (uid < 1) { throw new XmlRpcFaultException(0, "用户不存在"); } Entity.SpacePostInfo spacepostinfo = Discuz.Space.Provider.BlogProvider.GetSpacepostsInfo(DbProvider.GetInstance().GetSpacePost(int.Parse(postid))); Post post = ConvertPost(spacepostinfo, uid); return(post); }