/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Comment model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Comment model) { dal.Update(model); }
private void SaveComment(int id, int ptype) { if (ub.GetSub("FtCommentIsUser", xmlPath) == "2") { Utils.Error("评论已关闭", ""); } int meid = new BCW.User.Users().GetUsId(); if (ub.GetSub("FtCommentIsUser", xmlPath) == "1") { if (meid == 0) { Utils.Login(); } } Master.Title = "发表评论"; new BCW.User.Limits().CheckUserLimit(BCW.User.Limits.enumRole.Role_Comment, meid);//会员本身权限 builder.Append(Out.Tab("<div class=\"title\">发表评论</div>", "发表评论")); string mename = string.Empty; if (meid == 0) { mename = Utils.GetRequest("UsName", "post", 3, @"^[A-Za-zA-Z\d0-9\u4E00-\u9FA5]{1,7}$", "请输入不超过7个字的昵称,不能有特殊符号"); } else { mename = new BCW.BLL.User().GetUsName(meid); } if (string.IsNullOrEmpty(mename)) { mename = "网友"; } string Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1," + ub.GetSub("FtCommentLength", xmlPath) + "}$", "请输入不超过" + ub.GetSub("FtCommentLength", xmlPath) + "字的评论内容"); //是否刷屏 string appName = "LIGHT_COMMENT"; int Expir = Convert.ToInt32(ub.GetSub("FtCommentExpir", xmlPath)); BCW.User.Users.IsFresh(appName, Expir); //写入评论 BCW.Model.Comment model = new BCW.Model.Comment(); model.NodeId = new BCW.BLL.Detail().GetNodeId(id); if (ptype == 0) { model.Types = new BCW.BLL.Detail().GetTypes(id); } else { model.Types = 14; } model.DetailId = id; model.UserId = meid; model.UserName = mename; model.Face = 0; model.Content = Content; model.AddUsIP = Utils.GetUsIP(); model.AddTime = DateTime.Now; new BCW.BLL.Comment().Add(model); //更新评论条数 if (ptype == 0) { new BCW.BLL.Detail().UpdateRecount(id, 1); } else { new BCW.BLL.Goods().UpdateRecount(id, 1); } Utils.Success("发表评论", "发表成功,正在返回..", Utils.getUrl("comment.aspx?ptype=" + ptype + "&id=" + id + "&backurl=" + Utils.getPage(0) + ""), "1"); }