Beispiel #1
0
        public async Task <List <CommentReportDto> > GetAllCommentReport(string nickname, string title, string ishandle, string content)    //模糊查询
        {
            using (ICommentReportService creSvc = new CommentReportService())
            {
                var data = await creSvc.GetAllAsync()
                           .Where(m => string.IsNullOrEmpty(nickname) & string.IsNullOrEmpty(title) & string.IsNullOrEmpty(ishandle) & string.IsNullOrEmpty(content) ||
                                  m.User.NickName.Contains(nickname) & m.Comment.Article.Title.Contains(title) & m.IsHandle.ToString().Contains(ishandle) & m.Content.Contains(content))
                           .Where(m => m.IsRemoved == false)
                           .Include(m => m.Comment)
                           .Include(m => m.User)
                           .Include(m => m.Comment.Article)
                           .Select(m => new CommentReportDto()
                {
                    Id                 = m.Id,
                    ReportUserId       = m.Comment.User.Id,
                    Content            = m.Content,               //举报原因
                    NickName           = m.User.NickName,         //举报人
                    ReportUserNickName = m.Comment.User.NickName, //被举报人
                    CommentContent     = m.Comment.Content,       //被举报的评论
                    CreateTime         = m.CreateTime,
                    Title              = m.Comment.Article.Title,
                    IsHandle           = m.IsHandle, //是否已授理
                    IsFreeze           = m.Comment.User.IsFreeze
                }).ToListAsync();

                return(data);
            }
        }
Beispiel #2
0
        public async Task EditIsConfirmByUser(Guid userId)          //用户确认反馈信息
        {
            using (ICommentReportService comSvc = new CommentReportService())
            {
                var data = await comSvc.GetAllAsync().FirstOrDefaultAsync(m => m.UserId == userId);

                data.IsConfirm = true;
                await comSvc.EditAsync(data);
            }
        }
Beispiel #3
0
        public async Task RemoveCommentReportAdmin(Guid reportId)       //管理员删除举报记录
        {
            using (ICommentReportService comRepSvc = new CommentReportService())
            {
                var data = await comRepSvc.GetAllAsync().FirstOrDefaultAsync(m => m.Id == reportId);

                if (data != null)
                {
                    await comRepSvc.RemoveAsync(data);
                }
            }
        }
Beispiel #4
0
        public async Task EditHandleReport(Guid id, bool Ishandle = true)  //处理举报信息
        {
            using (ICommentReportService comRepSvc = new CommentReportService())
            {
                var data = await comRepSvc.GetAllAsync().FirstOrDefaultAsync(m => m.Id == id);

                if (data != null)
                {
                    data.IsHandle = Ishandle;
                    await comRepSvc.EditAsync(data);
                }
            }
        }
Beispiel #5
0
        public async Task EditeIsConfirmByBeReportUser(Guid userId)
        {
            using (ICommentReportService comSvc = new CommentReportService())
            {
                var data = await comSvc
                           .GetAllAsync()
                           .Include(m => m.Comment)
                           .FirstAsync(m => m.Comment.UserId == userId);

                if (data != null)
                {
                    data.IsBeReportUserConfirm = true;
                    await comSvc.EditAsync(data);
                }
            }
        }
        public async Task <CommentReportDto> GetAllReportsByUser(Guid userid, Guid commentid)        //判断是否存在举报记录
        {
            using (ICommentReportService comReSvc = new CommentReportService())
            {
                var data = await comReSvc.GetAllAsync()
                           .Where(m => m.UserId == userid & m.CommentId == commentid)
                           .Select(m => new CommentReportDto()
                {
                    UserId    = m.UserId,
                    CommentId = m.CommentId
                })
                           .FirstAsync();

                return(data);
            }
        }
Beispiel #7
0
        public async Task <List <CommentReportDto> > Bereported(Guid beRepuserid)
        {
            using (ICommentReportService comSvc = new CommentReportService())
            {
                var data = await comSvc.GetAllAsync()
                           .Include(m => m.Comment)
                           .Include(m => m.User)
                           .Include(m => m.Comment.Article)
                           .Where(m => m.Comment.UserId == beRepuserid & m.IsBeReportUserConfirm == false) //被举报人未确认提供反馈信息
                           .Select(m => new CommentReportDto()
                {
                    NickName       = m.User.NickName,         //举报人
                    CommentContent = m.Comment.Content,       //被举报的评论
                    Title          = m.Comment.Article.Title, //所在文章
                    UserId         = m.UserId,                //举报人Id
                    ArticleId      = m.Comment.ArticleId      //被评论所在文章Id
                }).ToListAsync();

                return(data);
            }
        }
Beispiel #8
0
        public async Task <List <CommentReportDto> > GetAllReportFeedBackInfo(Guid userid)
        {
            using (ICommentReportService commentReportService = new CommentReportService())
            {
                var data = await commentReportService.GetAllAsync()
                           .Include(m => m.User)
                           .Include(m => m.Comment.Article)
                           .Where(m => m.UserId == userid & m.IsHandle == true & m.IsConfirm == false) //true管理员已处理、用户未确认提供反馈信息
                           .Select(m => new CommentReportDto()
                {
                    IsHandle       = m.IsHandle,
                    NickName       = m.Comment.User.NickName, //被举报人
                    Content        = m.Content,
                    Title          = m.Comment.Article.Title,
                    ReportUserId   = m.Comment.UserId,
                    ArticleId      = m.Comment.ArticleId,
                    CommentContent = m.Comment.Content,
                    CreateTime     = m.CreateTime
                }).ToListAsync();

                return(data);
            }
        }
        public async Task <int> CreateCommentReport(Guid userid, Guid commentid, string content)  //举报评论
        {
            using (ICommentReportService creSvc = new CommentReportService())
            {
                var data = await creSvc.GetAllAsync()
                           .FirstOrDefaultAsync(m => m.UserId == userid & m.CommentId == commentid);

                if (data == null) //如果没记录可以举报
                {
                    await creSvc.CreateAsync(new CommentReport()
                    {
                        UserId    = userid,
                        CommentId = commentid,
                        Content   = content //举报原因
                    });

                    return(0);
                }
                else
                {
                    return(1);
                }
            }
        }