public void ProcessRequest(HttpContext context) { RequestModel requestModel = bllReview.ConvertRequestToModel <RequestModel>(new RequestModel()); if (string.IsNullOrWhiteSpace(requestModel.for_id)) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete; apiResp.msg = "评论对象Id为空"; bllReview.ContextResponse(context, apiResp); return; } BLLJIMP.Model.ReviewInfo review = new BLLJIMP.Model.ReviewInfo(); review.AuditStatus = 0; review.ForeignkeyId = requestModel.for_id; review.Expand1 = requestModel.ex_id; review.UserId = CurrentUserInfo.UserID; review.UserName = bllUser.GetUserDispalyName(CurrentUserInfo); review.ReviewScore = requestModel.score; review.ReviewContent = requestModel.content; review.InsertDate = DateTime.Now; review.ReviewType = requestModel.type; review.ReviewTitle = requestModel.title; review.WebsiteOwner = bllReview.WebsiteOwner; review.IsHideUserName = 0; review.ReviewMainId = int.Parse(bllReview.GetGUID(TransacType.CommAdd)); review.CommentImg = requestModel.comment_img; review.Ex2 = requestModel.order_detail_id; if (bllReview.Add(review)) { if (review.ReviewType == "OrderComment" && !string.IsNullOrWhiteSpace(review.Expand1)) //更新 平均分 评分人数 { var total = 0; List <BLLJIMP.Model.ReviewInfo> sourceData = bllReview.GetActReviewList(out total, 1, 0, "", "", "", "OrderComment", review.Expand1, "0", "AutoId"); double reviewAvgScore = bllReview.GetReviewAvgScore(bllReview.WebsiteOwner, "", "OrderComment", review.Expand1, "0"); bllReview.Update(new BLLJIMP.Model.WXMallProductInfo(), string.Format("ReviewCount='{0}',ReviewScore='{1}'", total, reviewAvgScore), string.Format("PID='{0}' And WebsiteOwner='{1}' ", review.Expand1, bllReview.WebsiteOwner)); bllReview.Update(new BLLJIMP.Model.WXMallOrderInfo(), string.Format("ReviewScore='{0}'", review.ReviewScore), string.Format("OrderID='{0}' And WebsiteOwner='{1}' ", review.ForeignkeyId, bllReview.WebsiteOwner)); } apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "评论完成"; BLLRedis.ClearReviewList(bllReview.WebsiteOwner); } else { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; apiResp.msg = "评论失败"; } bllReview.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string title = context.Request["Title"]; string content = context.Request["Context"]; if (string.IsNullOrEmpty(title)) { apiResp.msg = "标题不能为空"; context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp)); return; } if (string.IsNullOrEmpty(content)) { apiResp.msg = "内容不能为空"; context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp)); return; } currentWebsteInfo = bllUser.GetWebsiteInfoModelFromDataBase(); if (currentWebsteInfo.IsEnableUserReleaseReview == 0) { apiResp.msg = "暂不开放发布话题功能"; context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp)); return; } ReviewInfo model = new ReviewInfo { ForeignkeyId = bllUser.WebsiteOwner, ForeignkeyName = bllUser.WebsiteOwner, UserId = CurrentUserInfo.UserID, UserName = CurrentUserInfo.TrueName, ReviewPower = 0, InsertDate = DateTime.Now, ReviewTitle = title, ReviewContent = content, WebsiteOwner = bllUser.WebsiteOwner, PraiseNum = 0, StepNum = 0, ReviewType = "话题", CategoryType = "", ReplyDateTiem = DateTime.Now }; if (bllReview.Add(model)) { BLLRedis.ClearReviewList(bllUser.WebsiteOwner); apiResp.status = true; } else { apiResp.msg = "发布失败"; } context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp)); }
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)); }