Exemplo n.º 1
0
        /// <summary>
        /// 获取日志缓存文件内容,如果不存在则生成之
        /// </summary>
        /// <param name="postid">日志Id</param>
        /// <returns></returns>
        public static string GetSpacePostTagsCacheFile(int postid)
        {
            if (postid > 0)
            {
                string filename = Utils.GetMapPath(SpaceTags.GetSpacePostTagCacheFilePath(postid));
                string tags     = string.Empty;
                if (!File.Exists(filename))
                {
                    SpaceTags.WriteSpacePostTagsCacheFile(postid);
                }

                if (File.Exists(filename))
                {
                    using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
                        {
                            tags = sr.ReadToEnd();
                        }
                    }
                }

                return(tags);
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除空间日志
        /// </summary>
        /// <param name="postid"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static bool DeleteSpacePost(string postid, int userid)
        {
            bool success = Space.Data.DbProvider.GetInstance().DeleteSpacePosts(postid, userid);

            if (!success)
            {
                return(success);
            }

            foreach (string pid in postid.Split(','))
            {
                int spacepostid = Utils.StrToInt(pid, 0);
                if (spacepostid > 0)
                {
                    SpaceTags.DeleteSpacePostTags(spacepostid);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
 public override void GetSpacePostTagsCacheFile(int postid)
 {
     SpaceTags.WriteSpacePostTagsCacheFile(postid);
 }
Exemplo n.º 4
0
 public override void WriteHotTagsListForSpaceJSONPCacheFile(int count)
 {
     SpaceTags.WriteHotTagsListForSpaceJSONPCacheFile(count);
 }