Exemple #1
0
        private void addComment(object[] args, object target)
        {
            ForumPost  post    = args[0] as ForumPost;
            ForumTopic topic   = ForumTopic.findById(post.TopicId);
            User       creator = args[1] as User;
            IMember    owner   = args[2] as IMember;
            IApp       app     = args[3] as IApp;

            OpenComment c = new OpenComment();

            c.Content   = strUtil.ParseHtml(post.Content);
            c.TargetUrl = alink.ToAppData(topic);

            c.TargetDataType = typeof(ForumTopic).FullName;
            c.TargetDataId   = topic.Id;
            c.TargetTitle    = topic.Title;
            c.TargetUserId   = topic.Creator.Id;

            c.OwnerId = owner.Id;
            c.AppId   = app.Id;
            c.FeedId  = getFeedId(topic);

            c.Ip       = post.Ip;
            c.Author   = creator.Name;
            c.ParentId = 0;
            c.AtId     = 0;

            c.Member = creator;

            Result result = commentService.CreateNoNotification(c);

            // 修复comment额外的replies更新
            IForumTopicService topicService = ObjectContext.Create <IForumTopicService>(typeof(ForumTopicService));

            topic.Replies = topicService.CountReply(post.TopicId);
            topic.update("Replies");

            // 同步表
            CommentSync x = new CommentSync();

            x.Post    = post;
            x.Comment = result.Info as OpenComment;
            x.insert();
        }
Exemple #2
0
        private void addPost(object[] args, object target)
        {
            OpenComment comment = args[0] as OpenComment;

            if (comment == null || comment.Id <= 0)
            {
                return;
            }

            // 只监控论坛评论,其他所有评论跳过
            if (comment.TargetDataType != typeof(ForumTopic).FullName)
            {
                return;
            }

            // 附属信息
            ForumTopic topic   = commentService.GetTarget(comment) as ForumTopic;
            User       creator = comment.Member;
            IMember    owner   = getOwner(topic);
            IApp       app     = ForumApp.findById(topic.AppId);

            // 内容
            ForumPost post = new ForumPost();

            post.ForumBoardId = topic.ForumBoard.Id;
            post.TopicId      = topic.Id;
            post.ParentId     = getParentId(comment, topic);
            post.Title        = "re:" + topic.Title;
            post.Content      = comment.Content;
            post.Ip           = comment.Ip;


            // 保存
            // 因为comment本身已有通知,所以论坛不再发通知
            postService.InsertNoNotification(post, creator, owner, app);

            // 同步表
            CommentSync objSync = new CommentSync();

            objSync.Post    = post;
            objSync.Comment = comment;
            objSync.insert();
        }
Exemple #3
0
        private void addPost( object[] args, object target )
        {
            OpenComment comment = args[0] as OpenComment;
            if (comment == null || comment.Id <= 0) return;

            // 只监控论坛评论,其他所有评论跳过
            if (comment.TargetDataType != typeof( ForumTopic ).FullName) return;

            // 附属信息
            ForumTopic topic = commentService.GetTarget( comment ) as ForumTopic;
            User creator = comment.Member;
            IMember owner = getOwner( topic );
            IApp app = ForumApp.findById( topic.AppId );

            // 内容
            ForumPost post = new ForumPost();

            post.ForumBoardId = topic.ForumBoard.Id;
            post.TopicId = topic.Id;
            post.ParentId = getParentId( comment, topic );
            post.Title = "re:" + topic.Title;
            post.Content = comment.Content;
            post.Ip = comment.Ip;

            // 保存
            // 因为comment本身已有通知,所以论坛不再发通知
            postService.InsertNoNotification( post, creator, owner, app );

            // 同步表
            CommentSync objSync = new CommentSync();
            objSync.Post = post;
            objSync.Comment = comment;
            objSync.insert();
        }
Exemple #4
0
        private void addComment( object[] args, object target )
        {
            ForumPost post = args[0] as ForumPost;
            ForumTopic topic = ForumTopic.findById( post.TopicId );
            User creator = args[1] as User;
            IMember owner = args[2] as IMember;
            IApp app = args[3] as IApp;

            OpenComment c = new OpenComment();
            c.Content = strUtil.ParseHtml( post.Content );
            c.TargetUrl = alink.ToAppData( topic );

            c.TargetDataType = typeof( ForumTopic ).FullName;
            c.TargetDataId = topic.Id;
            c.TargetTitle = topic.Title;
            c.TargetUserId = topic.Creator.Id;

            c.OwnerId = owner.Id;
            c.AppId = app.Id;
            c.FeedId = getFeedId( topic );

            c.Ip = post.Ip;
            c.Author = creator.Name;
            c.ParentId = 0;
            c.AtId = 0;

            c.Member = creator;

            Result result = commentService.Create( c );

            // 同步表
            CommentSync x = new CommentSync();
            x.Post = post;
            x.Comment = result.Info as OpenComment;
            x.insert();
        }