public string Comment_API() { string action = Request["action"]; string value = ""; string result = ""; switch (action) { case "report": //举报 value = Request.Form["cid"]; cmtBll.ReportComment(Convert.ToInt32(value), mu.UserID); result = Success.ToString(); break; case "support": //支持反对操作 value = Request.Form["flag"]; bool rflag = true; bool flag = DataConverter.CLng(value) > 0; if (buser.GetLogin().IsNull) { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, EnviorHelper.GetUserIP()); } else { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, EnviorHelper.GetUserIP(), mu.UserID, mu.UserName); } result = rflag ? Success.ToString() : Failed.ToString(); break; case "assist": //顶与踩 bool bl = true; if (buser.GetLogin().IsNull) { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), Convert.ToInt32(Request.Form["gid"])); } else { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), mu.UserID, mu.UserName, Convert.ToInt32(Request.Form["gid"])); } result = bl ? "1" : "0"; break; case "reply": //回复 result = Comment_Reply(); break; case "sender": //发送评论 result = SendComm(); break; default: throw new Exception(action + "不存在"); } return(result); }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { string action = Request.Form["action"]; string value = ""; switch (action) { case "report": //举报 value = Request.Form["cid"]; M_UserInfo info = buser.GetLogin(); bcomment.ReportComment(Convert.ToInt32(value), info.UserID); Response.Write("1"); break; case "support": //支持反对操作 value = Request.Form["flag"]; bool result = true; if (buser.GetLogin().IsNull) { result = bcomment.Support(Convert.ToInt32(Request.Form["id"]), Convert.ToInt32(value), EnviorHelper.GetUserIP()); } else { result = bcomment.Support(Convert.ToInt32(Request.Form["id"]), Convert.ToInt32(value), EnviorHelper.GetUserIP(), buser.GetLogin().UserID, buser.GetLogin().UserName); } Response.Write(result?"1":"-1"); break; case "assist": //顶与踩 bool bl = true; if (buser.GetLogin().IsNull) { bl = bcomment.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), Convert.ToInt32(Request.Form["gid"])); } else { bl = bcomment.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), buser.GetLogin().UserID, buser.GetLogin().UserName, Convert.ToInt32(Request.Form["gid"])); } Response.Write(bl ? "1" : "0"); break; case "reply": //回复 Response.Write(btnHuiFu()); break; case "sender": //发送评论 Response.Write(SenderComm()); break; default: break; } Response.Flush(); Response.End(); } else if (!IsPostBack) { if (ItemID < 1) { function.WriteErrMsg("内容ID错误"); } //获取节点配置 M_CommonData cdata = bll.GetCommonData(ItemID); M_Node nodeMod = nodeBll.GetNodeXML(cdata.NodeID); C_Title = cdata.Title; ModelID = cdata.ModelID; switch (nodeMod.CommentType) { case "0": //关闭 nocoment.Visible = true; CommentInput.Visible = false; return; case "2": //注册用户 //islogin = buser.CheckLogin() ? 0 : 1; break; default: //游客 break; } comentyes.Visible = true; RPT.ItemDataBound += RPT_ItemDataBound; MyBind(); } }