Exemplo n.º 1
0
        public void DiggDown( int id )
        {
            if (ctx.viewer.IsLogin == false) {
                echoText( "�����¼���ܲ��������ȵ�¼" );
                return;
            }

            ContentPost post = postService.GetById( id, ctx.owner.Id );

            if (post == null) {
                echoText( lang( "exDataNotFound" ) );
                return;
            }

            ContentDigg digg = ContentDigg.find( "UserId=" + ctx.viewer.Id + " and PostId=" + post.Id ).first();
            if (digg != null) {
                echoText( "���Ѿ������������ظ�" );
                return;
            }

            ContentDigg d = new ContentDigg();
            d.UserId = ctx.viewer.Id;
            d.PostId = post.Id;
            d.TypeId = 1;
            d.Ip = ctx.Ip;
            d.insert();

            post.DiggDown++;
            post.update( "DiggDown" );

            echoAjaxOk();
        }
Exemplo n.º 2
0
        public void DiggDown(int id)
        {
            if (ctx.viewer.IsLogin == false)
            {
                echoText("必须登录才能操作,请先登录");
                return;
            }

            ContentPost post = postService.GetById(id, ctx.owner.Id);

            if (post == null)
            {
                echoText(lang("exDataNotFound"));
                return;
            }

            ContentDigg digg = ContentDigg.find("UserId=" + ctx.viewer.Id + " and PostId=" + post.Id).first();

            if (digg != null)
            {
                echoText("你已经操作,请勿重复");
                return;
            }

            ContentDigg d = new ContentDigg();

            d.UserId = ctx.viewer.Id;
            d.PostId = post.Id;
            d.TypeId = 1;
            d.Ip     = ctx.Ip;
            d.insert();

            post.DiggDown++;
            post.update("DiggDown");

            echoAjaxOk();
        }
Exemplo n.º 3
0
        public virtual void DiggUp( long id ) {

            if (ctx.viewer.IsLogin == false) {
                echoText( "必须登录才能操作,请先登录" );
                return;
            }

            ContentPost post = postService.GetById( id, ctx.owner.Id );

            if (post == null) {
                echoText( lang( "exDataNotFound" ) );
                return;
            }

            ContentDigg digg = ContentDigg.find( "UserId=" + ctx.viewer.Id + " and PostId=" + post.Id ).first();
            if (digg != null) {
                echoText( "你已经操作,请勿重复" );
                return;
            }

            ContentDigg d = new ContentDigg();
            d.UserId = ctx.viewer.Id;
            d.PostId = post.Id;
            d.TypeId = 0;
            d.Ip = ctx.Ip;
            d.insert();

            post.DiggUp++;
            post.update( "DiggUp" );

            echoAjaxOk();

        }