private void TimerFunction() { //判断是否到了刷新时间段 if (!IsInFreshduration()) { m_bIsInFreshduration = false; return; } if (m_bIsInFreshduration == false) { ShowLogString(string.Format("首次进入当日的刷新时间段,初始化数据")); //刚进入时间段,需要初始化次数 m_iHaveFreshedTime = 0; DataContrl.InitFreshTime(m_iGetPage); //ShowInfo string[] strArray = DataContrl.GetAllAccount().Split(','); _GoodsFreshStr goodInfo = new _GoodsFreshStr(); foreach (string strAcc in strArray) { if (strAcc == "") { break; } bool bRet = DataContrl.GetDataCache(strAcc, ref goodInfo); } } m_bIsInFreshduration = true; if (m_iHaveFreshedTime >= m_iGetPage) { ShowLogString(string.Format("已经达到设定的当日刷新次数")); return; } //判断是否超过了刷新间隔 TimeSpan tSpan = DateTime.Now - m_dLastFreshTime; int i = (int)tSpan.TotalMinutes; if (i < m_iRefreshInterval * 60) //未到刷新间隔 { return; } m_dLastFreshTime = DateTime.Now; //将列表中的所有账号加入等待刷新队列 DataContrl.InitFreshAccount(); m_iHaveFreshedTime++; ShowLogString(string.Format("达到刷新间隔时间,初始化刷新账号队列,刷新类型:{0}", m_iFreshType == 0?"一键刷新":"自定义刷新")); }
private void button1_Click(object sender, EventArgs e) { // _GoodsFreshStr objInfoEx = new _GoodsFreshStr(); //objInfoEx.strAcc = "aaa"; TestStr1 bulder = new TestStr1(); bulder.strAcc = "AAA"; Hashtable tblHash = new Hashtable(); bulder.strAcc = "AAABBB"; _GoodsFreshStr objInfoExEx = new _GoodsFreshStr(); string strDirectoryXls = System.AppDomain.CurrentDomain.BaseDirectory + "xlsfile"; SaveToExcel(strDirectoryXls, null, "aaaaa"); return; GoodsFresh objFreshEx = new GoodsFresh(); ClassHttpPost webPost = new ClassHttpPost(); objFreshEx.SetWebPost(webPost); string strDirect = System.AppDomain.CurrentDomain.BaseDirectory + "pic"; if (!Directory.Exists(strDirect)) { Directory.CreateDirectory(strDirect); } return; //string str = System.Web.HttpUtility.UrlEncode("你好", Encoding.GetEncoding("gb2312")); string str = string.Format("{0} {1}", 519.0, 535.01); MessageBox.Show(str); return; TimerFunction(); return; string strAcc = "heilongjiangjt"; _GoodsFreshStr objInfo = new _GoodsFreshStr(); DataContrl.GetDataCache(strAcc, ref objInfo); MessageBox.Show(objInfo.iFreshCount.ToString()); objInfo.iFreshCount = 2; //DataContrl.InitFreshTime(); DataContrl.GetDataCache(strAcc, ref objInfo); MessageBox.Show(objInfo.iFreshCount.ToString()); return; IsSetIllegal(); return; _GoodsFreshStr goodInfo = new _GoodsFreshStr(); bool bRet = DataContrl.GetDataCache("heilongjiangjt", ref goodInfo); if (!bRet) { return; } GoodsFresh objFresh = new GoodsFresh(); objFresh.SetWebPost(goodInfo.webPost); bRet = objFresh.Login(goodInfo.strAcc, goodInfo.strPwd, true); string strError = ""; objFresh.FreshQuick(out strError, out strError); }