Exemple #1
0
        private ForumApp createFirstForum(MvcContext ctx, String appName)
        {
            IMember owner   = ctx.owner.obj;
            User    creator = ctx.viewer.obj as User;

            IMemberApp mapp = installService.Install(typeof(ForumApp), owner, creator, appName);

            // 初始化权限,否则无法访问
            base.initAppPermission(mapp);
            ForumApp app = ForumApp.findById(mapp.AppOid);

            createBoardList(ctx, app);

            return(app);
        }
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();
        }