Exemplo n.º 1
0
        private void makeLog( AdminValue av )
        {
            List<ForumTopic> topics = GetByIds( av.Ids );

            foreach (ForumTopic topic in topics) {

                logService.AddTopic( av.User, av.AppId, topic.Id, av.ActionId, av.Reason, av.Ip );

                // 发送短信通知
                if (!av.IsSendMsg) continue;

                String msg = ForumLogAction.GetLable( av.ActionId );
                String title = string.Format( alang.get( typeof( ForumApp ), "adminPostMsgTitle" ), topic.Title, msg );

                String topicInfo = "<a href='" + alink.ToAppData( topic ) + "'>" + topic.Title + "</a>";
                if (av.ActionId == ForumLogAction.Delete) topicInfo = topic.Title;

                String body = string.Format( alang.get( typeof( ForumApp ), "adminPostMsgBody" ), topicInfo, msg, DateTime.Now, av.Reason );

                msgService.SiteSend( title, body, topic.Creator );
            }
        }
Exemplo n.º 2
0
 public virtual void MakeSticky( AdminValue av )
 {
     av.ActionId = ForumLogAction.Sticky;
     AdminUpdate( "set Status=" + TopicStatus.Sticky, av.Condition );
     AddAuthorIncome( av.Condition, UserAction.Forum_TopicSticky.Id, "置顶" );
     makeLog( av );
 }
Exemplo n.º 3
0
 public virtual void MakeStickyUndo( AdminValue av )
 {
     av.ActionId = ForumLogAction.UnSticky;
     AdminUpdate( "set Status=" + TopicStatus.Normal, av.Condition );
     //取消置顶不减少积分
     makeLog( av );
 }
Exemplo n.º 4
0
 public virtual void MakePick( AdminValue av )
 {
     av.ActionId = ForumLogAction.Pick;
     AdminUpdate( "set IsPicked=1", av.Condition );
     AddAuthorIncome( av.Condition, UserAction.Forum_TopicPicked.Id, "加为精华" );
     makeLog( av );
 }
Exemplo n.º 5
0
 public virtual void MakePickUndo( AdminValue av )
 {
     av.ActionId = ForumLogAction.UnPick;
     AdminUpdate( "set IsPicked=0", av.Condition );
     //取消精华不减少积分
     makeLog( av );
 }
Exemplo n.º 6
0
 public virtual void MakeLockUndo( AdminValue av )
 {
     av.ActionId = ForumLogAction.UnLock;
     AdminUpdate( "set IsLocked=0", av.Condition );
     // 积分规则中本身定义的是负值,所以反操作用SubstractIncome
     SubstractAuthorIncome( av.Condition, UserAction.Forum_TopicLocked.Id, "取消锁定" );
     makeLog( av );
 }
Exemplo n.º 7
0
        public virtual void MakeMove( int targetForumId, AdminValue av)
        {
            av.ActionId = ForumLogAction.MoveTopic;

            String condition = "Id in (" + av.Ids + ")";
            String conditionPost = "TopicId in (" + av.Ids + ")";
            String action = "set ForumBoardId=" + targetForumId;

            db.updateBatch<ForumTopic>( action, condition );
            db.updateBatch<ForumPost>( action, conditionPost );

            makeLog( av );
        }
Exemplo n.º 8
0
 public virtual void MakeHighlightUndo( AdminValue av )
 {
     av.ActionId = ForumLogAction.UnHighlight;
     String action = "set TitleStyle=''";
     ForumTopic.updateBatch( action, av.Condition );
     makeLog( av );
 }
Exemplo n.º 9
0
 public virtual void MakeLock( AdminValue av )
 {
     av.ActionId = ForumLogAction.Lock;
     AdminUpdate( "set IsLocked=1", av.Condition );
     // 积分规则中本身定义的是负值,所以此处用AddIncome
     AddAuthorIncome( av.Condition, UserAction.Forum_TopicLocked.Id, "锁定" );
     makeLog( av );
 }
Exemplo n.º 10
0
 public virtual void MakeHighlight( String style, AdminValue av )
 {
     av.ActionId = ForumLogAction.Highlight;
     String action = string.Format( "set TitleStyle='{0}'", style );
     ForumTopic.updateBatch( action, av.Condition );
     makeLog( av );
 }
Exemplo n.º 11
0
        public virtual void MakeGlobalSticky( AdminValue av )
        {
            av.ActionId = ForumLogAction.GlobalSticky;

            ForumApp app = db.findById<ForumApp>( av.AppId );
            if (app == null) return;

            List<ForumTopic> newStickTopics = db.find<ForumTopic>( av.Condition ).list();

            app.StickyTopic = StickyTopic.MergeData( app.StickyTopic, newStickTopics );
            db.update( app );

            makeLog( av );
        }
Exemplo n.º 12
0
 public virtual void MakeCategory( int categoryId, AdminValue av )
 {
     av.ActionId = ForumLogAction.SetCategory;
     String action = string.Format( "set CategoryId=" + categoryId );
     ForumTopic.updateBatch( action, av.Condition );
     makeLog( av );
 }
Exemplo n.º 13
0
        public virtual void DeleteList( AdminValue av )
        {
            av.ActionId = ForumLogAction.Delete;

            DeleteListToTrash( av.Ids );
            // 积分规则中本身定义的是负值,所以此处用AddIncome
            AddAuthorIncome( av.Condition, UserAction.Forum_TopicDeleted.Id, "删除" );

            // 检查总置顶
            StickyTopic.DeleteTopic( av.AppId, av.Ids );

            makeLog( av );
        }
Exemplo n.º 14
0
        //-----------------------------------------------------------------------------------------------------
        private AdminValue av()
        {
            AdminValue v = new AdminValue();

            v.Ids = idList;
            v.AppId = ctx.app.Id;

            v.User = (User)ctx.viewer.obj;
            v.Reason = ctx.PostIsCheck( "chkReason" ) == 1 ? ctx.Post( "reasonText" ) : ctx.Post( "reasonSelect" );

            v.Ip = ctx.Ip;
            v.IsSendMsg = ctx.PostIsCheck( "IsSendMsg" ) == 1;

            return v;
        }