/// <summary> /// 获取话题列表 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void GETHTLIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string userName = UserInfo.User.UserName; int page = 0; int pagecount = 8; int.TryParse(context.Request["p"] ?? "1", out page); //页码 int.TryParse(context.Request["pagecount"] ?? "8", out pagecount); //页数 page = page == 0 ? 1 : page; int recordCount = 0; string strWhere = string.Format(" sq.ComId={0} ", UserInfo.User.ComId); string strContent = context.Request["Content"] ?? ""; strContent = strContent.TrimEnd(); if (strContent != "") { strWhere += string.Format(" And ( sq.HTNR like '%{0}%' )", strContent); } string leibie = context.Request["lb"] ?? ""; if (leibie != "") { if (leibie == "0")//精华 { strWhere += string.Format(" And sq.ISJH='Y' "); } else { strWhere += string.Format(" And sq.LeiBie='{0}' ", leibie); } } string biaoqian = context.Request["biaoqian"] ?? "";//标签 if (biaoqian != "" && biaoqian != "全部") { strWhere += string.Format(" And sq.biaoqian='{0}' ", biaoqian); } int DataID = -1; int.TryParse(context.Request["ID"] ?? "-1", out DataID);//记录Id if (DataID != -1) { strWhere += string.Format(" And sq.ID = '{0}'", DataID); } if (P1 != "") { switch (P1) { case "0": { //设置usercenter已读 new JH_Auth_User_CenterB().ReadMsg(UserInfo, DataID, "TSSQ"); } break; case "1": //我的 { strWhere += " And sq.CRUser='******'"; } break; case "2": //我评论过的 { //DataTable dtPL = new JH_Auth_TLB().GetDTByCommand(string.Format("SELECT tl.MSGTLYID FROM JH_Auth_TL tl WHERE tl.MSGType='TSSQ' AND tl.MsgISShow <> 'Y' AND tl.CRUser='******'", UserInfo.User.UserName)); string htIDs = new JH_Auth_TLB().GetEntities(d => d.MSGType == "TSSQ" && d.CRUser == UserInfo.User.UserName && (d.MsgISShow != "Y" && d.MsgISShow != "N")).Select(d => d.MSGTLYID).ToList().ListTOString(','); if (!string.IsNullOrWhiteSpace(htIDs)) { strWhere += "And sq.ID IN (" + htIDs + ") "; } else { strWhere += "And sq.ID ='' "; } } break; case "3": //全部可看的 { strWhere += " And (ISNULL(sq.CYR,'') = '' OR ','+sq.CYR+',' like '%," + userName + ",%' )"; } break; } DataTable dt = new SZHL_TSSQB().GetDataPager(@" SZHL_TSSQ sq LEFT JOIN JH_Auth_ZiDian zd ON sq.LeiBie=zd.ID and Class=19 left join JH_Auth_User u on sq.CRUser=u.UserName", " sq.*,zd.TypeName,u.UserRealName,u.zhiwu ", pagecount, page, " sq.Status DESC,sq.CRDate DESC ", strWhere, ref recordCount); dt = APIHelp.GetDWByUserName(dt, UserInfo.User.ComId.Value); #region 附件评论 string Ids = ""; string fileIDs = ""; foreach (DataRow row in dt.Rows) { Ids += row["ID"].ToString() + ","; if (!string.IsNullOrEmpty(row["Files"].ToString())) { fileIDs += row["Files"].ToString() + ","; } } Ids = Ids.TrimEnd(','); fileIDs = fileIDs.TrimEnd(','); if (Ids != "") { List <FT_File> FileList = new List <FT_File>(); DataTable dtPL = new JH_Auth_TLB().GetDTByCommand(string.Format("SELECT tl.* FROM JH_Auth_TL tl WHERE tl.MSGType='TSSQ' AND (ISNULL(tl.MsgISShow,'') <> 'Y' and ISNULL(tl.MsgISShow,'') <> 'N') AND tl.MSGTLYID in ({0}) ORDER BY CRDate ASC", Ids)); DataTable zandt = new JH_Auth_TLB().GetDTByCommand(string.Format("SELECT tl.* FROM JH_Auth_TL tl WHERE tl.MSGType='TSSQ' AND MsgISShow='Y' AND tl.MSGTLYID in ({0})", Ids)); dtPL = APIHelp.GetDWByUserName(dtPL, UserInfo.User.ComId.Value); zandt = APIHelp.GetDWByUserName(zandt, UserInfo.User.ComId.Value); if (!string.IsNullOrEmpty(fileIDs)) { int[] fileId = fileIDs.SplitTOInt(','); FileList = new FT_FileB().GetEntities(d => fileId.Contains(d.ID)).ToList(); } dt.Columns.Add("PLList", Type.GetType("System.Object")); dt.Columns.Add("FileList", Type.GetType("System.Object")); dt.Columns.Add("ZanList", Type.GetType("System.Object")); dt.Columns.Add("IsZan", Type.GetType("System.Object")); foreach (DataRow row in dt.Rows) { DataTable dtPLs = dtPL.FilterTable("MSGTLYID='" + row["ID"] + "'"); dtPLs.Columns.Add("FileList", Type.GetType("System.Object")); foreach (DataRow dr in dtPLs.Rows) { if (dr["MSGisHasFiles"] != null && dr["MSGisHasFiles"].ToString() != "") { int[] fileIds = dr["MSGisHasFiles"].ToString().SplitTOInt(','); dr["FileList"] = new FT_FileB().GetEntities(d => fileIds.Contains(d.ID)); } } row["PLList"] = dtPLs; row["ZanList"] = zandt.FilterTable("MSGTLYID='" + row["ID"] + "'"); row["IsZan"] = zandt.FilterTable(" MSGTLYID='" + row["ID"] + "' and CRUser='******'").Rows.Count > 0 ? "Y" : "N"; if (FileList.Count > 0) { string[] fileIds = row["Files"].ToString().Split(','); row["FileList"] = FileList.Where(d => fileIds.Contains(d.ID.ToString())); } } msg.Result3 = dtPL; } #endregion msg.Result = dt; msg.Result1 = recordCount; new SZHL_TSSQB().ExsSclarSql("UPDATE SZHL_TSSQ SET RedUsers= RedUsers+'," + UserInfo.User.UserName + "' WHERE ','+RedUsers+',' NOT like '%," + UserInfo.User.UserName + ",%'"); } }
/// <summary> /// 添加话题 /// </summary> /// <param name="context"></param> /// <param name="msg"></param> /// <param name="P1"></param> /// <param name="P2"></param> /// <param name="UserInfo"></param> public void ADDHT(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { if (UserInfo.User.isJY == "Y" && UserInfo.User.JYDate > DateTime.Now) { msg.ErrorMsg = "您已被禁言!无法发表交流"; return; } SZHL_TSSQ tssq = JsonConvert.DeserializeObject <SZHL_TSSQ>(P1); if (!string.IsNullOrEmpty(tssq.HTNR) && APIHelp.TestWB(tssq.HTNR) != "0") { msg.ErrorMsg = "您得发言涉及违规内容,请完善后再发"; return; } if (!string.IsNullOrEmpty(tssq.URL) && !tssq.URL.Contains("http://")) { tssq.URL = "http://" + tssq.URL; } if (P2 != "") // 处理微信上传的图片 { string fids = new FT_FileB().ProcessWxIMG(P2, "TSSQ", UserInfo); if (!string.IsNullOrEmpty(tssq.Files)) { tssq.Files += "," + fids; } else { tssq.Files = fids; } } if (tssq.ID == 0) { tssq.CRDate = DateTime.Now; tssq.CRUser = UserInfo.User.UserName; tssq.ComId = UserInfo.User.ComId; tssq.Status = 0; tssq.RedUsers = UserInfo.User.UserName; new SZHL_TSSQB().Insert(tssq); SZHL_TXSX CSTX = new SZHL_TXSX(); CSTX.Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CSTX.APIName = "TSSQ"; CSTX.ComId = UserInfo.User.ComId; CSTX.FunName = "SENDHTMSG"; CSTX.CRUserRealName = UserInfo.User.UserRealName; CSTX.MsgID = tssq.ID.ToString(); CSTX.ISCS = "N"; CSTX.TXUser = tssq.CRUser; CSTX.TXMode = "TSSQ"; CSTX.CRUser = UserInfo.User.UserName; TXSX.TXSXAPI.AddALERT(CSTX); //时间为发送时间 } else { new SZHL_TSSQB().Update(tssq); } msg.Result = tssq; }