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); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request["ReviewId"])) { Response.Write("ReviewId 参数必传"); Response.End(); } Review = bllReview.Get <ReviewInfo>(string.Format(" AutoId={0}", Request["ReviewId"])); if (Review == null) { Response.Write("ReviewId 参数错误"); Response.End(); } }
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)); }