Exemplo n.º 1
0
        private void QuartzGuidForach(object quartzParam)
        {
            if (this.InvokeRequired)
            {//是否通过其他形式调用
                DelegateData.BaseDelegate bd = new DelegateData.BaseDelegate(QuartzGuidForach);
                this.Invoke(bd, quartzParam);
                return;
            }
            LoggerWriter.CreateLogFile(Cookie, (new QQDataDA().GeneratePathTimeSpan(Cookie)), ELogType.SessionOrCookieLog);
            QueryQQParam param = GetBaseQueryParam();
            QQDataDA     da    = new QQDataDA();

            da.QueryParam = param;
            PickUpQQDoResponse response = da.QueryQQData(Cookie);
            // QueryTodayPickUp();
            //为下一次产生随机参数
            Guid   gid = Guid.NewGuid();
            Random ran = new Random(gid.GetHashCode());
            //所在城市联动
            int szd   = ran.Next(0, 8);
            int ps    = cmbProvince.Items.Count;
            int guidP = ran.Next(0, ps);

            cmbProvince.SelectedIndex = guidP;
            QuartzCallBack(response);
        }
Exemplo n.º 2
0
        private PickUpQQDoResponse ForeachFindQQ(QueryQQParam param, string cookie)
        {
            string json    = param.UrlParam();
            string logPath = LogPrepare.GetLogPath();

            LoggerWriter.CreateLogFile(json, logPath, ELogType.ParamLog);
            string response = HttpClientExtend.HttpWebRequestPost(findQQAccountUrl, json, cookie);
            //将查询反馈的数据写入到数据库中

            // LoggerWriter.CreateLogFile(response, logPath, ELogType.DataLog);
            ConfigurationItems c        = new ConfigurationItems();
            FindQQDataManage   manage   = new FindQQDataManage(c.TecentDA_Read);
            JsonData           jsondata = new JsonData();
            PickUpQQDoResponse pickup   = new PickUpQQDoResponse();

            pickup.responseData = manage.SaveFindQQ(response);
            //此处开启一个线程查询qq群组

            pickup.cookie       = cookie;
            pickup.request      = json;
            pickup.responseJson = response;
            if (callback != null)
            {
            }
            return(pickup);
        }
Exemplo n.º 3
0
        private void JustQuery(QueryQQParam param)
        {
            QQDataDA da = new QQDataDA();

            da.QueryParam = param;
            SendNotification(AppNotify.Name_Backstage, null, AppNotify.Get_UsableProxy);

            PickUpQQDoResponse response = da.QueryQQData(Cookie);

            if (GatherFirstUin || !SystemConfig.OpenAutoQuertyDBTotal)
            {//这里要改成在页面初始化时查询当前库数据量,其他情形交给另一线程查询
                SyncUinStatics();
                GatherFirstUin = false;
            }
            QuartzCallBack(response);
        }
Exemplo n.º 4
0
        private void QuartzCallBack(object data)
        {
            if (rtbTip.InvokeRequired)
            {//其他进程调度
                DelegateData.BaseDelegate bd = new DelegateData.BaseDelegate(QuartzCallBack);
                this.Invoke(bd, data);
                return;
            }
            PickUpQQDoResponse res = data as PickUpQQDoResponse;

            if (res == null)
            {
                return;
            }                           // 1 no cookie
            //如果此时检测返回集合为空,但是返回状态码不是错误,需要更改检测条件【腾讯防攻击检测】
            QueryResponseAction(res);
            if (!SystemConfig.OpenAutoQuertyDBTotal)
            {
                SyncUinStatics();
            }
        }
Exemplo n.º 5
0
        private void QuartzForeachPage(object data)
        {
            if (this.InvokeRequired)
            {//是否通过其他形式调用
                DelegateData.BaseDelegate bd = new DelegateData.BaseDelegate(QuartzForeachPage);
                this.Invoke(bd, data);
                return;
            }
            QueryQQParam param = GetBaseQueryParam();
            int          page  = currentIndex + 1;

            param.page = page;
            QQDataDA da = new QQDataDA();

            da.QueryParam = param;
            PickUpQQDoResponse response = da.QueryQQData(Cookie);

            if (response == null)
            {
                rtbTip.Text = "No Cookie";
                return;
            }
            FindQQResponse resp = response.responseData;

            if (resp != null && resp.retcode == 0 && resp.result.buddy.totalnum > param.num)
            {
                txtPageIndex.Text = (page + 1).ToString();
            }
            else
            {
                page = 1;
                txtPageIndex.Text = page.ToString();
            }
            QueryResponseAction(response);
            if (!SystemConfig.OpenAutoQuertyDBTotal)
            {
                SyncUinStatics();
            }
        }
Exemplo n.º 6
0
 private void QueryResponseAction(PickUpQQDoResponse res)
 {
     executeNum++;//当前执行次数
     //  GetContainerKeyOfCookie(res.cookie);//查询qq群组数据[qq群数据提取参数待确定]
     if (res != null && res.responseData != null)
     {
         FindQQResponse qqres = res.responseData;
         StringBuilder  sb    = new StringBuilder();
         sb.AppendLine("code\t" + qqres.retcode);
         sb.AppendLine("DB Total\t" + qqres.result.buddy.totalnum);
         sb.AppendLine("now count\t" + qqres.result.buddy.info_list.Count);//info_list 可能出现为null的情况
         rtbTip.Text = sb.ToString();
         if (qqres.retcode == QQRetCode.Normal.GetHashCode() && qqres.result.buddy.info_list.Count > 0)
         {
             return;
         }
         else if (qqres.retcode == QQRetCode.Normal.GetHashCode())
         {//数据读取正常(但是当前没有查找到数据)
             //数据读取正常也可能出现腾讯没有提供返回数据(腾讯在进行防作弊检测)
             ProtectJob();
             return;
         }
         if (qqres.retcode == QQRetCode.CookieTimeOut.GetHashCode())
         { //该账户已退出登录
             rtbTip.Text = "该账户已退出";
             job.DeleteJob <JobDelegateFunction>();
             job.DeleteJob <JobAction <QQDataDA> >();
             return;
         }
         if (qqres.retcode != QQRetCode.Forbin.GetHashCode())
         {//延迟轮询的间隔
             //更改轮询条件
             ProtectJob();
         }
         else if (qqres.retcode == QQRetCode.Forbin.GetHashCode())
         {//已被腾讯封号【禁用时进行程序关闭,并反馈到邮箱】
             job.DeleteJob <JobDelegateFunction>();
             job.DeleteJob <JobAction <QQDataDA> >();
             rtbTip.Text = "该账户本次检测被禁用";
             DataLink      dl  = new DataLink();
             StringBuilder tip = new StringBuilder();
             tip.AppendLine("time:\t" + DateTime.Now.ToString(SystemConfig.DateTimeFormat));
             tip.AppendLine("App:\tCaptureWebData");
             tip.AppendLine("App Event:Pick up uin data [warm]");
             tip.AppendLine("account:\t" + Uin);
             string subject = string.Format(ConfigurationItems.ErrorSubjetFormat, " Uin" + DateTime.Now.ToString(CommonFormat.DateIntFormat));
             dl.SendDataToOtherPlatform(subject, tip.ToString());//需要知道当前在进行采集的账户
         }
     }
     else
     {
         //返回消息转换为实体对象
         FindQQResponse find = res.responseJson.ConvertObject <FindQQResponse>();
         if (find == null && res.responseJson.Contains(SystemConfig.IIS501))
         {
             rtbTip.Text = SystemConfig.IIS501;
             // Application.ExitThread();
         }
         else if (find.retcode != QQRetCode.Forbin.GetHashCode() && find.retcode != QQRetCode.CookieTimeOut.GetHashCode())
         { //错误不是来自于账户不禁用
             ProtectJob();
             return;
         }
         else
         {
             //判断返回数据的情况
             rtbTip.Text = "Error\r\n" + res.responseJson;
         }
         //一旦出现数据异常(防止被腾讯检测导致封号),停止轮询
         job.DeleteJob <JobDelegateFunction>();
         job.DeleteJob <JobAction <QQDataDA> >();
     }
     if (executeNum % SystemConfig.DivideNum == 0)
     {//满足发送邮件的条件
         DataLink      dl  = new DataLink();
         StringBuilder tip = new StringBuilder();
         tip.AppendLine("time:\t" + DateTime.Now.ToString(SystemConfig.DateTimeFormat));
         tip.AppendLine("App:\tCaptureWebData");
         tip.AppendLine("App Event:Pick up uin data [excute num]" + executeNum);
         tip.AppendLine("account:\t" + Uin);
         string subject = string.Format(ConfigurationItems.ErrorSubjetFormat, " Uin" + DateTime.Now.ToString(CommonFormat.DateIntFormat));
         dl.SendDataToOtherPlatform(subject, tip.ToString());//需要知道当前在进行采集的账户
     }
 }