public virtual void Insert(Microblog blog, int i)
        {
            String rcontent = blog.Content;

            MicroblogBinder smbinder = new MicroblogBinder();

            MicroblogParser mp = new MicroblogParser(blog.Content, smbinder);

            mp.Process();

            blog.Content = mp.ToString();

            blog.Content = processEmotions(blog.Content);

            Result result = blog.insert();

            if (i == 0)
            {
                // 保存tag
                TagService.SaveDataTag(blog, mp.GetTagList());

                // 发通知
                addNotification(smbinder.GetValidUsers(), blog);
            }

            // 转发需要刷新原帖的转发量
            if (blog.ParentId > 0)
            {
                Microblog parent = GetById(blog.ParentId);
                if (parent != null)
                {
                    parent.Reposts = Microblog.count("ParentId=" + parent.Id);
                    parent.update("Reposts");
                }
            }

            if (result.IsValid)
            {
                addFeedInfo(blog);
            }
        }
 public virtual int CountByUser(int userId)
 {
     return(Microblog.count("UserId=" + userId));
 }
Beispiel #3
0
 public virtual int CountByUser(int userId)
 {
     return(Microblog.count("UserId=" + userId + showCondition()));
 }