예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            string autoId = context.Request["id"];

            if (string.IsNullOrEmpty(autoId))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                apiResp.msg  = "id 为必填项,请检查";
                bllReview.ContextResponse(context, apiResp);
                return;
            }
            ReviewInfo model = bllReview.GetReviewByAutoId(int.Parse(autoId));

            if (model == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                apiResp.msg  = "评论已经删除";
                bllReview.ContextResponse(context, apiResp);
                return;
            }
            if (bllReview.Delete(new ReviewInfo(), string.Format(" WebsiteOwner='{0}' AND AutoID={1}", bllReview.WebsiteOwner, int.Parse(autoId))) > 0)
            {
                apiResp.status = true;
                apiResp.msg    = "ok";
                int reviewCount = bllReview.GetReviewCount(BLLJIMP.Enums.ReviewTypeKey.AppointmentComment, model.ForeignkeyId, model.UserId);
                bllJuActivity.Update(new JuActivityInfo(), string.Format(" CommentCount={0} AND CommentAndReplayCount='{0}' ", reviewCount), string.Format(" JuActivityID={0}", model.ForeignkeyId));
            }
            else
            {
                apiResp.msg  = "删除评论失败";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllReview.ContextResponse(context, apiResp);
        }
예제 #2
0
파일: List.ashx.cs 프로젝트: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            int rows            = Convert.ToInt32(context.Request["rows"]),
                page            = Convert.ToInt32(context.Request["page"]);
            string for_id       = context.Request["for_id"],
                   ex_id        = context.Request["ex_id"],
                   keyword      = context.Request["keyword"],
                   type         = context.Request["type"],
                   status       = context.Request["status"];
            string websiteOwner = bllReview.WebsiteOwner;

            var total = 0;
            //评论
            List <BLLJIMP.Model.ReviewInfo> sourceData = bllReview.GetActReviewList(out total, page, rows, for_id, keyword, "", type, ex_id, status
                                                                                    , "AutoId,ReviewMainId,UserId,ReviewContent,InsertDate,ReviewScore,CommentImg,ForeignkeyId,Expand1,Ex2");

            List <dynamic> returnList           = new List <dynamic>();
            List <BLLJIMP.Model.UserInfo> users = new List <BLLJIMP.Model.UserInfo>();

            foreach (var item in sourceData)
            {
                BLLJIMP.Model.UserInfo pubUser = users.FirstOrDefault(p => p.UserID == item.UserId);
                if (pubUser == null)
                {
                    pubUser = bllUser.GetUserInfo(item.UserId, websiteOwner);
                    if (pubUser != null)
                    {
                        users.Add(pubUser);
                    }
                }
                WXMallOrderDetailsInfo orderDetails = bllReview.Get <WXMallOrderDetailsInfo>(string.Format(" AutoID={0} ", !string.IsNullOrEmpty(item.Ex2)?item.Ex2:"0"));

                returnList.Add(new
                {
                    id           = item.ReviewMainId,
                    content      = item.ReviewContent,
                    time         = ZentCloud.Common.DateTimeHelper.DateTimeToUnixTimestamp(item.InsertDate),
                    review_score = item.ReviewScore,
                    comment_img  = item.CommentImg,
                    showprops    = orderDetails == null?"":orderDetails.SkuShowProp,
                    pub_user     = pubUser == null? null: new {
                        id     = pubUser.AutoID,
                        avatar = bllUser.GetUserDispalyAvatar(pubUser),
                        name   = bllUser.GetUserDispalyName(pubUser)
                    }
                });
            }
            apiResp.status = true;
            apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            apiResp.result = new
            {
                totalcount = total,
                list       = returnList
            };
            bllReview.ContextResponse(context, apiResp);
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            var commentId      = context.Request["commentid"];
            var replyId        = Convert.ToInt32(context.Request["replyid"]);//回复了评论里的哪个回复
            var content        = context.Request["content"];
            int isHideUserName = Convert.ToInt32(context.Request["isHideUserName"]);

            currentUserInfo = bllUser.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(commentId) || string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllReview.ContextResponse(context, apiResp);
                return;
            }


            if (bllReview.GetCount <ReviewInfo>(string.Format(" ReviewMainId = {0} ", commentId)) == 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                bllReview.ContextResponse(context, apiResp);
                return;
            }

            //敏感词检查
            BLLFilterWord bllFilterWord = new BLLFilterWord();
            string        errmsg        = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllReview.WebsiteOwner, out errmsg, "0"))
            {
                apiResp.msg  = errmsg;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllReview.ContextResponse(context, apiResp);
                return;
            }

            //添加回复

            int reviewId = 0;

            var addResult = bllReview.AddReview(BLLJIMP.Enums.ReviewTypeKey.CommentReply, commentId, replyId, this.currentUserInfo.UserID, "评论", content, this.bllReview.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                apiResp.status = true;
                apiResp.result = reviewId.ToString();

                if (bllUser.IsTutor(this.currentUserInfo.UserID))
                {
                    bllTutor.UpdateAnswers(this.currentUserInfo.UserID);
                }
            }
            else
            {
                apiResp.status = false;
            }
            bllReview.ContextResponse(context, apiResp);
        }
예제 #4
0
파일: Comment.ashx.cs 프로젝트: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            var articleId = context.Request["articleid"];
            var content   = context.Request["content"];
            var replyId   = Convert.ToInt32(context.Request["replyid"]);//评论了文章里的哪个评论

            int isHideUserName = Convert.ToInt32(context.Request["ishideusername"]);

            currentUserInfo = bllUser.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(articleId) || string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (bllUser.GetCount <JuActivityInfo>(string.Format(" JuActivityID = {0} ", articleId)) == 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //敏感词检查
            BLLFilterWord bllFilterWord = new BLLFilterWord();
            string        errmsg        = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllUser.WebsiteOwner, out errmsg, "0"))
            {
                apiResp.msg  = errmsg;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //添加评论
            int            reviewId = 0;
            JuActivityInfo article  = bll.GetJuActivity(int.Parse(articleId), true);

            BLLJIMP.Enums.ReviewTypeKey reviewType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (article.ArticleType == "Question")
            {
                reviewType = BLLJIMP.Enums.ReviewTypeKey.Answer;
            }
            var addResult = bllReview.AddReview(reviewType, articleId, replyId, this.currentUserInfo.UserID, "评论", content, this.bll.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                if (reviewType == BLLJIMP.Enums.ReviewTypeKey.Answer)
                {
                    bllUser.AddUserScoreDetail(this.currentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.AnswerQuestions), this.bll.WebsiteOwner, null, null);
                }

                if (article.ArticleType == "Question")
                {
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.QuestionIsAnswered, this.currentUserInfo, article, article.UserID, content);

                    List <UserInfo> users = bllUser.GetRelationUserList(BLLJIMP.Enums.CommRelationType.JuActivityFollow, articleId);
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.FollowQuestionIsAnswered, this.currentUserInfo, article, users, content);
                }
                apiResp.status = true;
                apiResp.msg    = "评论完成";
                apiResp.result = reviewId.ToString();
                apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            }
            else
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "评论出错";
            }
            bllReview.ContextResponse(context, apiResp);
        }