Exemple #1
0
        /// <summary>
        /// 删除文章评论
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string DeleteArticleReview(HttpContext context)
        {
            if (!bll.IsLogin)
            {
                resp1.errcode = (int)errcode.UnLogin;
                resp1.errmsg  = "尚未登录";
                goto outoff;
            }
            string          id     = context.Request["id"];
            ReplyReviewInfo review = bll.Get <ReplyReviewInfo>(string.Format(" AutoID={0} And UserId='{1}'", id, currentUserInfo.UserID));

            if (review == null)
            {
                resp1.errcode = 1;
                resp1.errmsg  = "无权删除";
                goto outoff;
            }
            if (bll.Delete(review) == 0)
            {
                resp1.errcode = 2;
                resp1.errmsg  = "删除失败";
                goto outoff;
            }
            resp1.errmsg = "删除成功";
            //bll.Delete(new ReplyReviewInfo(), string.Format(" PraentId={0}", Review.AutoId));
outoff:
            return(Common.JSONHelper.ObjectToJson(resp1));
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            int             autoId      = int.Parse(context.Request["AutoID"]);
            string          content     = context.Request["Context"];
            ReviewInfo      reviewInfo  = bllReview.Get <ReviewInfo>(string.Format("AutoId={0}", autoId));
            ReplyReviewInfo replyReview = new ReplyReviewInfo()
            {
                ReviewID     = Convert.ToInt32(autoId),
                InsertDate   = DateTime.Now,
                ReplyContent = content,
                UserId       = CurrentUserInfo.UserID,
                UserName     = CurrentUserInfo.LoginName,
                PraentId     = 0,
                WebSiteOwner = bllReview.WebsiteOwner
            };
            bool isSuccess = bllReview.Add(replyReview);

            if (isSuccess)
            {
                reviewInfo.NumCount++;
                reviewInfo.ReplyDateTiem = DateTime.Now;
                if (bllReview.Update(reviewInfo))
                {
                    //给回复者加分
                    int replyCount = bllReview.GetCount <ReplyReviewInfo>(string.Format("ReviewID={0} And  UserId='{1}'", autoId, CurrentUserInfo.UserID));
                    if (replyCount <= 1)//第一次回答才得分
                    {
                        bllUser.AddUserScoreDetail(CurrentUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.AnswerQuestions), bllUser.WebsiteOwner, null, null);
                    }
                    apiResp.status = true;
                }
                else
                {
                }
            }
            else
            {
            }
            BLLRedis.ClearReviewList(bllReview.WebsiteOwner);
            context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
        }
Exemple #3
0
        /// <summary>
        /// 发表回复评论信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string ReplyArticleReview(HttpContext context)
        {
            if (!bll.IsLogin)
            {
                resp1.errcode = (int)errcode.UnLogin;
                resp1.errmsg  = "尚未登录";
                goto outoff;
            }
            if (!CheckUserIsReg(currentUserInfo))
            {
                resp1.errcode = 5;
                resp1.errmsg  = "请先注册";
                goto outoff;
            }
            int    articleId = int.Parse(context.Request["articleid"]);
            int    reviewId  = int.Parse(context.Request["id"]);
            string content   = context.Request["replycontent"];

            if (string.IsNullOrEmpty(content))
            {
                resp1.errcode = 1;
                resp1.errmsg  = "输入评论内容";
                goto outoff;
            }
            if (!CheckArtickeReviewContent(content))
            {
                resp1.errcode = 2;
                resp1.errmsg  = "您的评论包含不适合发布的内容,请重新编辑";
                goto outoff;
            }
            bool isSuccess = bll.Add(new BLLJIMP.Model.ReplyReviewInfo
            {
                ReplyContent = content,
                UserId       = currentUserInfo.UserID,
                InsertDate   = DateTime.Now,
                WebSiteOwner = bll.WebsiteOwner,
                UserName     = currentUserInfo.TrueName ?? "匿名用户",
                ReviewType   = "文章评论",
                PraentId     = reviewId,
                ReviewID     = articleId
            });

            if (isSuccess)
            {
                resp1.errcode = 0;
                resp1.errmsg  = "回复成功";
                #region 消息提示
                ReplyReviewInfo review = bll.Get <ReplyReviewInfo>(string.Format(" AutoID={0}", reviewId));
                bllSysNotice.SendSystemMessage("您的评论有新的回复", "您的评论有新的回复,点击查看", 1, 2, review.UserId, string.Format("http://{0}/WuBuHui/News/NewsDetail.aspx?id={1}", context.Request.Url.Host, articleId), bll.WebsiteOwner);
                #endregion
                goto outoff;
            }
            else
            {
                resp1.errcode = 3;
                resp1.errmsg  = "回复失败";
            }

outoff:
            return(Common.JSONHelper.ObjectToJson(resp1));
        }