Exemple #1
0
        static void Test()
        {
            DataLink      dl  = new DataLink();
            StringBuilder tip = new StringBuilder();

            tip.AppendLine("time:\t" + DateTime.Now.ToString(SystemConfig.DateTimeFormat));
            tip.AppendLine("App :\t CaptureWebData");
            tip.AppendLine("Event:run app");
            dl.SendDataToOtherPlatform(string.Format(ConfigurationItems.ErrorSubjetFormat, " Uin" + DateTime.Now.ToString(CommonFormat.DateIntFormat)), tip.ToString());//需要知道当前在进行采集的账户
            PickUpTianMaoHtml tm  = new PickUpTianMaoHtml();
            string            dir = new AppDirHelper().GetAppDir(AppCategory.WinApp);

            tm.DoHtmlFileAnalysis(dir + @"\HttpResponse\list.tmall.com\HttpResponse");
        }
 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());//需要知道当前在进行采集的账户
     }
 }