protected void ReplyBtn_Click(object sender, EventArgs e) { if (Session["lastposttime"] != null) { if (StrDateDiffSeconds(Session["lastposttime"].ToString(), 15) < 0) { replymsg = "您发帖太过频繁了,请等待15秒"; return; } } Reply r = new Reply(); r.Fid = fid; r.Tid = tid; r.Title = ""; r.Message = Util.RemoveUnsafeHtml(Request.Form["replytext"]); if (r.Message.Length < 5) replymsg = "message length is short!please send more"; else { TopicReplyResponse trr = ds.TopicReply(r); Session["lastposttime"] = DateTime.Now; if ((postsLength + 1) / maxpostscount >= maxpageindex) { Response.Redirect("replypad.aspx?tid=" + tid + "&pageindex=" + (maxpageindex + 1)); } else { Response.Redirect("replypad.aspx?tid=" + tid + "&pageindex=" + maxpageindex); } } }
/// <summary> /// 回复帖子 /// </summary> /// <param name="reply"></param> /// <returns></returns> public TopicReplyResponse TopicReply(Reply reply) { List<DiscuzParam> param_list = new List<DiscuzParam>(); if (session_info != null && !string.IsNullOrEmpty(session_info.SessionKey)) { param_list.Add(DiscuzParam.Create("session_key", session_info.SessionKey)); } param_list.Add(DiscuzParam.Create("reply_info", JavaScriptConvert.SerializeObject(reply))); TopicReplyResponse trr = util.GetResponse<TopicReplyResponse>("topics.reply", param_list.ToArray()); return trr; }