/// <summary> /// 正文的正负判断 /// </summary> /// <param name="str1">正文</param> /// <returns></returns> public static int GetParts(string str1) { DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd(); DataTable dtParts; dtParts = cmd.GetTabel("SELECT * FROM partword"); int z = 0; int f = 0; for (int i = 0; i < dtParts.Rows.Count; i++) { if (dtParts.Rows[i][2].ToString() == "0") { f += util.Comm.partCount(str1, dtParts.Rows[i][1].ToString()); } else { z += util.Comm.partCount(str1, dtParts.Rows[i][1].ToString()); } } if (z > f) { return(1); } else { return(0); } }
//判断url是否已经被抓取过,被抓取过的,就不再抓取 public static bool UrlExist(string url) { bool result = false; DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd(); String sql = "select count(0) from urls where url='" + url + "'"; int count = int.Parse(cmd.GetOne(sql).ToString()); result = count > 0 ? true : false; return(result); }
public static DataPage GetPageInfo() { DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd(); #region 获取查询开始uid int pageSize = 500; string maxuidsql = "select max(uid) from releaseinfo"; object oc = cmd.GetOne(maxuidsql); long maxId = 0; if (!(oc is System.DBNull)) { if (oc is long) { maxId = (long)oc; } else { maxId = (int)oc; } } string minuidsql = "select min(uid) from releaseinfo"; oc = cmd.GetOne(minuidsql); long minId = 0; if (!(oc is System.DBNull)) { if (oc is long) { minId = (long)oc; } else { minId = (int)oc; } } #endregion DataPage dp = new DataPage(); dp.maxUid = maxId; dp.minUid = minId; dp.pageSize = pageSize; dp.pageIdx = 1; dp.pageCount = (maxId - minId) / pageSize; dp.isInited = true; return(dp); }
private void delExpiredDbData_Elapsed(object sender, EventArgs e) { string SoftVer = !GlobalPars.GloPars.ContainsKey("SoftVer") ? "1" : GlobalPars.GloPars["SoftVer"].ToString(); if (SoftVer.Equals("3")) { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-60 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } else if (SoftVer.Equals("2")) { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-45 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } else { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-30 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } }
/// <summary> /// 生成缓存数据 /// </summary> private void GenCacheData() { //以下缓存报警信息 DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); string sql = "select Id,EvidenceImgSavePath from systemset"; DataTable dt = dbobj.GetTabel(sql); SystemSet ss = new SystemSet(); if (dt != null && dt.Rows.Count > 0) { ss.Id = dt.Rows[0]["Id"].ToString(); string path = dt.Rows[0]["EvidenceImgSavePath"].ToString(); if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(path); } ss.EvidenceImgSavePath = path; } else { //向数据库插入一条数据 string path = Path.Combine(Directory.GetCurrentDirectory(), "EvidenceImgSavePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } sql = "insert into systemset values('1', 'EvidenceImgSavePath')"; if (dbobj.ExecuteNonQueryInt(sql) > 0) { ss.Id = "1"; ss.EvidenceImgSavePath = path; } } GlobalPars.GloPars.Add("systemset", ss); }
public static DataPage GetPageInfo() { DataBaseServer.MySqlCmd cmd = new DataBaseServer.MySqlCmd(); #region 获取查询开始uid int pageSize = 500; string maxuidsql = "select max(uid) from releaseinfo"; object oc = cmd.GetOne(maxuidsql); long maxId = 0; if (!(oc is System.DBNull)) { if (oc is long) { maxId = (long)oc; } else { maxId = (int)oc; } } string minuidsql = "select min(uid) from releaseinfo"; oc = cmd.GetOne(minuidsql); long minId = 0; if (!(oc is System.DBNull)) { if (oc is long) { minId = (long)oc; } else { minId = (int)oc; } } #endregion DataPage dp = new DataPage(); dp.maxUid = maxId; dp.minUid = minId; dp.pageSize = pageSize; dp.pageIdx = 1; dp.pageCount = (maxId - minId) / pageSize; dp.isInited = true; return dp; }
/// <summary> /// 生成缓存数据 /// </summary> private void GenCacheData() { //以下缓存报警信息 DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); string sql = "select Id,EvidenceImgSavePath from systemset"; DataTable dt = dbobj.GetTabel(sql); SystemSet ss = new SystemSet(); if (dt != null && dt.Rows.Count > 0) { ss.Id = dt.Rows[0]["Id"].ToString(); string path = dt.Rows[0]["EvidenceImgSavePath"].ToString(); if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(path); } ss.EvidenceImgSavePath = path; } else { //向数据库插入一条数据 string path = Path.Combine(Directory.GetCurrentDirectory(), "EvidenceImgSavePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } sql = "insert into systemset values('1', 'EvidenceImgSavePath')"; if (dbobj.ExecuteNonQueryInt(sql) > 0) { ss.Id = "1"; ss.EvidenceImgSavePath = path; } } GlobalPars.GloPars.Add("systemset", ss); }
private void delExpiredDbData_Elapsed(object sender, EventArgs e) { string SoftVer = !GlobalPars.GloPars.ContainsKey("SoftVer") ? "1" : GlobalPars.GloPars["SoftVer"].ToString(); if (SoftVer.Equals("3")) { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-60 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } else if (SoftVer.Equals("2")) { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-45 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } else { string sql = "delete from ReleaseInfo where datetime(CollectDate) < datetime('now','-30 day');"; DataBaseServer.MySqlCmd dbobj = new DataBaseServer.MySqlCmd(); dbobj.ExecuteNonQuery(sql); } }