private void GetItem(HttpContext context) { int aid = GetInt("newid"); var item = ActiveHelper.GetItem(aid); if (item == null) { ReturnErrorMsg("不存在该活动"); return; } var data = new { newid = item.Id, title = item.Title, img = Utility.GetSizePicUrl(item.CoverImgUrl, 540, 400, context), summary = item.Summary, descrition = item.Description, dateline = item.CreateTime.GetUnixTime(), Views = item.Views, Commentnum = item.Commentnum }; item.Views++; ActiveHelper.Update(item); JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", data); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void ActiveComment(HttpContext context) { int aid = GetInt("newid"); int uid = GetInt("uid"); var user = AccountHelper.GetUser(uid); string msg = GetString("message"); var active = ActiveHelper.GetItem(aid); Comment c = new Comment(); c.SellerId = active.SellerId; c.TypeId = active.Id; c.UserId = uid; c.Content = msg; c.Type = CommentType.Avtive; //冗余两个字段 c.Img = active.CoverImgUrl; c.Title = active.Title; try { CommentHelper.Create(c); active.Commentnum += 1; ActiveHelper.Update(active); } catch { ReturnErrorMsg("fail"); throw; } ExtcreditLog log = new ExtcreditLog(); var merchantExtend = SystemHelper.GetMerchantExtend(user.SellerId); if (!ExtcreditLogHelper.JudgeExtcreditGet(ExtcreditSourceType.CommentActive, aid, uid)) { //积分获得 log.UserId = uid; log.SellerId = user.SellerId; log.SourceId = aid; log.Extcredit = merchantExtend != null ? merchantExtend.CommentIntegral : 0; log.Type = ExtcreditSourceType.CommentActive; log.CreateTime = DateTime.Now; ExtcreditLogHelper.AddExtcreditLog(log); user.Integral += log.Extcredit; AccountHelper.SaveAccount(user); } //ReturnCorrectMsg("评论成功"); JsonTransfer jt = new JsonTransfer(); jt.Add("data", new IntegralData(log.Extcredit)); jt.AddSuccessParam(); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void UpdateData() { var id = GetInt("id"); var active = ActiveHelper.GetItem(id); active.CouponId = GetInt("ticket_id"); active.Title = GetString("Title"); active.CoverImgUrl = GetString("thumbnail"); active.Description = GetString("content"); var text = GetString("text"); active.Summary = text.Length > 20 ? text.Substring(0, 20) : text; //active.Summary = active.Description.Length > 20 ? active.Description.Substring(0, 20) : active.Description; ActiveHelper.Update(active); }