Exemplo n.º 1
0
 public static void Tcp3()
 {
     try
     {
         string html = HtmlOperate.GetHtml("http://f.apiplus.net/pl3.xml");
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string text       = xmlNode2.Attributes["expect"].InnerText;
                     string innerText2 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(text) || string.IsNullOrEmpty(innerText2))
                     {
                         new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
                         break;
                     }
                     if (text.Length == 5)
                     {
                         text = "20" + text;
                     }
                     string text2 = text;
                     if (innerText2.Length == 5)
                     {
                         if (!new LotteryDataDAL().Exists(3003, text2))
                         {
                             if (!innerText2.Contains("255"))
                             {
                                 new LotteryDataDAL().Add(3003, text2, innerText2, DateTime.Now.ToString("yyyy-MM-dd") + " 20:30:00", "");
                                 Public.SetOpenListJson(3003);
                                 LotteryCheck.RunOfIssueNum(3003, text2);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "P3获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 2
0
 public static void QqSsc()
 {
     try
     {
         foreach (JsonData jsonData in (IEnumerable)JsonMapper.ToObject("{\"rows\":10,\"data\":" + HtmlOperate2.HttpGet("http://www.77tj.org/api/tencent/onlineim", Encoding.UTF8) + "}")["data"])
         {
             string   opentime  = jsonData["onlinetime"].ToString();
             string   _number   = jsonData["onlinenumber"].ToString();
             DateTime dateTime1 = Convert.ToDateTime(opentime);
             DateTime now       = DateTime.Now;
             DateTime dateTime2 = Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00");
             TimeSpan timeSpan  = dateTime1 - dateTime2;
             int      num1      = timeSpan.Hours * 60 + timeSpan.Minutes + 1;
             string   str1      = string.Concat((object)num1);
             if (num1.ToString().Length == 1)
             {
                 str1 = "000" + (object)num1;
             }
             if (num1.ToString().Length == 2)
             {
                 str1 = "00" + (object)num1;
             }
             if (num1.ToString().Length == 3)
             {
                 str1 = "0" + (object)num1;
             }
             now = DateTime.Now;
             string str2 = now.ToString("yyyyMMdd") + "-" + str1;
             if (string.IsNullOrEmpty(opentime) || string.IsNullOrEmpty(str2) || string.IsNullOrEmpty(_number))
             {
                 new LogExceptionDAL().Save("采集异常", "腾讯分分彩找不到开奖数据的关键字符");
                 break;
             }
             string str3 = str2;
             if (!new LotteryDataDAL().Exists(1005, str3) && !new LotteryDataDAL().Exists(1005, str3, _number))
             {
                 int num2  = 0;
                 int int32 = Convert.ToInt32(_number);
                 while (int32 > 0)
                 {
                     num2  += int32 % 10;
                     int32 /= 10;
                 }
                 string[] strArray = _number.Split(',');
                 string   Number   = (num2 % 10).ToString() + "," + (object)Convert.ToInt32(_number.Substring(_number.Length - 4, 1)) + "," + (object)Convert.ToInt32(_number.Substring(_number.Length - 3, 1)) + "," + (object)Convert.ToInt32(_number.Substring(_number.Length - 2, 1)) + "," + (object)Convert.ToInt32(_number.Substring(_number.Length - 1, 1));
                 new LotteryDataDAL().Add(1005, str3, Number, opentime, string.Join(",", strArray));
                 Public.SetOpenListJson(1005);
                 LotteryCheck.RunOfIssueNum(1005, str3);
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "腾讯分分彩获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 3
0
        private static DateTime?OpenTime      = null; //开奖时间

        public static void QqSsc()
        {
            try
            {
                //http://api.b1cp.com/t?p=json&t=qqffc&token=FF446B723EB25993
                //http://www.b1cp.com/api?p=json&t=txffc&limit=1&token=00fb782bad8e5241
                Log.Debug("开始腾迅分分彩...");

                SysLotteryModel sysLottery = _lotteryDal.GetSysLotteryByCode("qqffc");

                if (sysLottery == null || string.IsNullOrEmpty(sysLottery.ApiUrl))
                {
                    throw new Exception("无效的API配置");
                }

                //Stopwatch sw = new Stopwatch();
                //sw.Start(); //  开始监视代码运行时间

                //如果上期开奖时间大于1分钟
                if (OpenTime.HasValue && OpenTime.Value.AddSeconds(60) > DateTime.Now)
                {
                    return;
                }

                //string url = "http://api.b1cp.com/t?p=json&t=txffc&token=776E371D7EF404E4";
                //IList<ByLottery> data = ByHelper.GetLotteryData(url);
                IList <ByLottery> data = ByHelper.GetLotteryData(sysLottery.ApiUrl);

                //sw.Stop(); //  停止监视
                //Log.DebugFormat("获取腾迅分分彩花费时间: {0}毫秒", sw.Elapsed.Milliseconds);

                foreach (ByLottery lot in data)
                {
                    string openTime = lot.opentime;
                    string openCode = lot.opencode;
                    string expect   = lot.expect; //期号

                    expect = expect.Substring(0, 8) + "-" + expect.Substring(8);

                    //存储开奖号码
                    if (_dal.Update(1005, expect, openCode, openTime, openCode))
                    {
                        OpenTime = Convert.ToDateTime(openTime);  //开奖时间
                        Public.SaveLotteryData2File(1005);        //存储开奖号码到JSON/XML文件
                        LotteryCheck.RunOfIssueNum(1005, expect); //处理开奖信息
                    }
                }
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("腾讯分分彩异常: {0}", ex);
                //new LogExceptionDAL().Save("采集异常", "腾讯分分彩获取开奖数据出错,错误代码:" + ex.Message);
            }
        }
        /// <summary>
        /// 更新彩票数据
        /// </summary>
        /// <param name="code">彩票编码</param>
        public static void UpdateData(object code = null)
        {
            try
            {
                //http://api.b1cp.com/t?p=json&t=qqffc&token=FF446B723EB25993
                //http://www.b1cp.com/api?p=json&t=txffc&limit=1&token=00fb782bad8e5241
                //Log.Debug("开始QqSsc...");

                //if (code == "ssl")
                //{
                //    string test = "";
                //}

                SysLotteryModel sysLottery = _lotteryDal.GetSysLotteryByCode(code.ToString());

                Log.DebugFormat("获取开奖信息: {0} {1}", sysLottery.Title, sysLottery.Code);
                if (sysLottery == null || string.IsNullOrEmpty(sysLottery.ApiUrl))
                {
                    throw new Exception("无效的API配置");
                }

                int lotId = sysLottery.Id; //彩票Id
                IList <ByLottery> data = ByHelper.GetLotteryData(sysLottery.ApiUrl);

                foreach (ByLottery lot in data)
                {
                    string openTime = lot.opentime;
                    string openCode = lot.opencode;
                    string expect   = lot.expect; //期号

                    expect = GetExpect(code.ToString(), expect);

                    if (_dal.Update(lotId, expect, openCode, openTime, openCode))
                    {
                        Public.SaveLotteryData2File(lotId);
                        LotteryCheck.RunOfIssueNum(lotId, expect);
                        Log.DebugFormat("发布开奖信息: {0} {1}", sysLottery.Title, openCode);
                    }

                    Log.DebugFormat("开奖信息详细: {0} {1} {2}", sysLottery.Title, expect, openCode);
                }
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("官方彩票异常: {0} {1}", code != null ? code.ToString() : "奖种无效", ex);
                //new LogExceptionDAL().Save("采集异常", "腾讯分分彩获取开奖数据出错,错误代码:" + ex.Message);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 更新彩票开奖信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="title"></param>
        /// <param name="number"></param>
        /// <param name="opentime"></param>
        /// <param name="numberAll"></param>
        /// <returns></returns>
        public void UpdateLottery()
        {
            try
            {
                //生成开奖号码
                this.GenerateCheck();

                Log.DebugFormat("保存开奖期号:{0} {1} {2}", this.Name, this.ExpectNo, this.Number);

                //开奖信息入库
                if (_lotteryDataDal.Update(this.SysLottery.Id, this.ExpectNo, this.Number, this.OpenTime, this.NumberAll))
                {
                    Public.SaveLotteryData2File(this.Id);
                    LotteryCheck.RunOfIssueNum(this.Id, this.ExpectNo);
                }
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("开奖发生异常: {0} {1}", this.Name, ex);
            }
        }
Exemplo n.º 6
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html1 = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, (object)lotteryId));
         if (string.IsNullOrEmpty(html1))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符1" + (object)lotteryId);
         }
         else
         {
             XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
             if (xmlNode1 == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符2" + (object)lotteryId);
             }
             else if (xmlNode1.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符3" + (object)lotteryId);
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode1)
                 {
                     string innerText1 = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符4" + (object)lotteryId);
                         break;
                     }
                     bool   flag  = true;
                     string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/lottery" + (object)lotteryId + ".xml");
                     if (!string.IsNullOrEmpty(html2))
                     {
                         foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                         {
                             if (xmlNode3.Attributes["expect"].InnerText.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string str = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, str))
                         {
                             string[] strArray = innerText3.Split(',');
                             string   Number   = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                             new LotteryDataDAL().Add(lotteryId, str, Number, innerText1, string.Join(",", strArray));
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, str);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 7
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, lotteryId));
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
                         break;
                     }
                     bool   flag  = true;
                     string text  = ConfigurationManager.AppSettings["RootUrl"].ToString();
                     string html2 = HtmlOperate.GetHtml(string.Concat(new object[]
                     {
                         text,
                         "/Data/lottery",
                         lotteryId,
                         ".xml"
                     }));
                     if (!string.IsNullOrEmpty(html2))
                     {
                         XmlNodeList xmlNode3 = Public.GetXmlNode(html2, "row");
                         foreach (XmlNode xmlNode4 in xmlNode3)
                         {
                             string innerText4 = xmlNode4.Attributes["expect"].InnerText;
                             if (innerText4.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string text2 = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, text2))
                         {
                             new LotteryDataDAL().Add(lotteryId, text2, innerText3, innerText, innerText3);
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, text2);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 8
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, lotteryId));
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符1");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符2");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符3");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符4");
                         break;
                     }
                     bool   flag  = true;
                     string text  = ConfigurationManager.AppSettings["RootUrl"].ToString();
                     string html2 = HtmlOperate.GetHtml(string.Concat(new object[]
                     {
                         text,
                         "/Data/lottery",
                         lotteryId,
                         ".xml"
                     }));
                     if (!string.IsNullOrEmpty(html2))
                     {
                         XmlNodeList xmlNode3 = Public.GetXmlNode(html2, "row");
                         foreach (XmlNode xmlNode4 in xmlNode3)
                         {
                             string innerText4 = xmlNode4.Attributes["expect"].InnerText;
                             if (innerText4.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string text2 = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, text2))
                         {
                             string[] array = innerText3.Split(new char[]
                             {
                                 ','
                             });
                             int    num    = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3]) + Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6])) % 10;
                             int    num2   = (Convert.ToInt32(array[7]) + Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11]) + Convert.ToInt32(array[12]) + Convert.ToInt32(array[13])) % 10;
                             int    num3   = (Convert.ToInt32(array[14]) + Convert.ToInt32(array[15]) + Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                             string number = string.Concat(new object[]
                             {
                                 num,
                                 ",",
                                 num2,
                                 ",",
                                 num3
                             });
                             new LotteryDataDAL().Add(lotteryId, text2, number, innerText, string.Join(",", array));
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, text2);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 9
0
        public static void CqSsc()
        {
            try
            {
                string html = HtmlOperate.GetHtml(Config.DefaultUrl);
                if (!string.IsNullOrEmpty(html))
                {
                    XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
                    if (xmlNode == null)
                    {
                        (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符2");
                    }
                    else if (xmlNode.Count != 0)
                    {
                        foreach (XmlNode xmlNodes in xmlNode)
                        {
                            string innerText  = xmlNodes.Attributes["code"].InnerText;
                            string str        = xmlNodes.Attributes["expect"].InnerText;
                            string str1       = xmlNodes.Attributes["opencode"].InnerText.Replace("+", ",");
                            string innerText1 = xmlNodes.Attributes["opentime"].InnerText;
                            if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str1))
                            {
                                (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符4");
                                return;
                            }
                            else
                            {
                                bool   flag  = true;
                                string html1 = HtmlOperate.GetHtml(string.Concat(ConfigurationManager.AppSettings["RootUrl"].ToString(), "/Data/hisStory.xml"));
                                if (!string.IsNullOrEmpty(html1))
                                {
                                    foreach (XmlNode xmlNode1 in Public.GetXmlNode(html1, "row"))
                                    {
                                        string innerText2 = xmlNode1.Attributes["code"].InnerText;
                                        string str2       = xmlNode1.Attributes["expect"].InnerText;
                                        if (!innerText2.Equals(innerText) || !str2.Equals(str))
                                        {
                                            continue;
                                        }
                                        flag = false;
                                    }
                                }
                                if (!flag || str1.Contains("255"))
                                {
                                    continue;
                                }
                                string str3 = innerText;
                                switch (str3)
                                {
                                case "cqssc":
                                {
                                    string str4 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1001, str4))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1001, str4, str1, innerText1, "");
                                    Public.SetOpenListJson(1001);
                                    LotteryCheck.RunOfIssueNum(1001, str4);
                                    break;
                                }

                                case "xjssc":
                                {
                                    string str5 = string.Concat(str.Substring(0, 8), "-", str.Substring(9));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1003, str5))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1003, str5, str1, innerText1, "");
                                    Public.SetOpenListJson(1003);
                                    LotteryCheck.RunOfIssueNum(1003, str5);
                                    break;
                                }

                                case "tjssc":
                                {
                                    string str6 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1007, str6))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1007, str6, str1, innerText1, "");
                                    Public.SetOpenListJson(1007);
                                    LotteryCheck.RunOfIssueNum(1007, str6);
                                    break;
                                }

                                case "twbingo":
                                {
                                    if ((new LotteryDataDAL()).Exists(1013, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays = str1.Split(new char[] { ',' });
                                    int      num       = (Convert.ToInt32(strArrays[0]) + Convert.ToInt32(strArrays[1]) + Convert.ToInt32(strArrays[2]) + Convert.ToInt32(strArrays[3])) % 10;
                                    int      num1      = (Convert.ToInt32(strArrays[4]) + Convert.ToInt32(strArrays[5]) + Convert.ToInt32(strArrays[6]) + Convert.ToInt32(strArrays[7])) % 10;
                                    int      num2      = (Convert.ToInt32(strArrays[8]) + Convert.ToInt32(strArrays[9]) + Convert.ToInt32(strArrays[10]) + Convert.ToInt32(strArrays[11])) % 10;
                                    int      num3      = (Convert.ToInt32(strArrays[12]) + Convert.ToInt32(strArrays[13]) + Convert.ToInt32(strArrays[14]) + Convert.ToInt32(strArrays[15])) % 10;
                                    int      num4      = (Convert.ToInt32(strArrays[16]) + Convert.ToInt32(strArrays[17]) + Convert.ToInt32(strArrays[18]) + Convert.ToInt32(strArrays[19])) % 10;
                                    string   str7      = string.Concat(new object[] { num, ",", num1, ",", num2, ",", num3, ",", num4 });
                                    (new LotteryDataDAL()).Add(1013, str, str7, innerText1, string.Join(",", strArrays));
                                    Public.SetOpenListJson(1013);
                                    LotteryCheck.RunOfIssueNum(1013, str);
                                    break;
                                }

                                case "sd11x5":
                                {
                                    string str8 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2001, str8))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2001, str8, str1, innerText1, "");
                                    Public.SetOpenListJson(2001);
                                    LotteryCheck.RunOfIssueNum(2001, str8);
                                    break;
                                }

                                case "gd11x5":
                                {
                                    string str9 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2002, str9))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2002, str9, str1, innerText1, "");
                                    Public.SetOpenListJson(2002);
                                    LotteryCheck.RunOfIssueNum(2002, str9);
                                    break;
                                }

                                case "sh11x5":
                                {
                                    string str10 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2003, str10))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2003, str10, str1, innerText1, "");
                                    Public.SetOpenListJson(2003);
                                    LotteryCheck.RunOfIssueNum(2003, str10);
                                    break;
                                }

                                case "jx11x5":
                                {
                                    string str11 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2004, str11))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2004, str11, str1, innerText1, "");
                                    Public.SetOpenListJson(2004);
                                    LotteryCheck.RunOfIssueNum(2004, str11);
                                    break;
                                }

                                case "krkeno":
                                {
                                    if ((new LotteryDataDAL()).Exists(1017, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays1 = str1.Split(new char[] { ',' });
                                    int      num5       = (Convert.ToInt32(strArrays1[0]) + Convert.ToInt32(strArrays1[1]) + Convert.ToInt32(strArrays1[2]) + Convert.ToInt32(strArrays1[3])) % 10;
                                    int      num6       = (Convert.ToInt32(strArrays1[4]) + Convert.ToInt32(strArrays1[5]) + Convert.ToInt32(strArrays1[6]) + Convert.ToInt32(strArrays1[7])) % 10;
                                    int      num7       = (Convert.ToInt32(strArrays1[8]) + Convert.ToInt32(strArrays1[9]) + Convert.ToInt32(strArrays1[10]) + Convert.ToInt32(strArrays1[11])) % 10;
                                    int      num8       = (Convert.ToInt32(strArrays1[12]) + Convert.ToInt32(strArrays1[13]) + Convert.ToInt32(strArrays1[14]) + Convert.ToInt32(strArrays1[15])) % 10;
                                    int      num9       = (Convert.ToInt32(strArrays1[16]) + Convert.ToInt32(strArrays1[17]) + Convert.ToInt32(strArrays1[18]) + Convert.ToInt32(strArrays1[19])) % 10;
                                    string   str12      = string.Concat(new object[] { num5, ",", num6, ",", num7, ",", num8, ",", num9 });
                                    (new LotteryDataDAL()).Add(1017, str, str12, innerText1, string.Join(",", strArrays1));
                                    Public.SetOpenListJson(1017);
                                    LotteryCheck.RunOfIssueNum(1017, str);
                                    break;
                                }

                                case "xdlkl8":
                                {
                                    string str13 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if ((new LotteryDataDAL()).Exists(1011, str13))
                                    {
                                        continue;
                                    }
                                    string[] strArrays2 = str1.Split(new char[] { ',' });
                                    int      num10      = (Convert.ToInt32(strArrays2[0]) + Convert.ToInt32(strArrays2[1]) + Convert.ToInt32(strArrays2[2]) + Convert.ToInt32(strArrays2[3])) % 10;
                                    int      num11      = (Convert.ToInt32(strArrays2[4]) + Convert.ToInt32(strArrays2[5]) + Convert.ToInt32(strArrays2[6]) + Convert.ToInt32(strArrays2[7])) % 10;
                                    int      num12      = (Convert.ToInt32(strArrays2[8]) + Convert.ToInt32(strArrays2[9]) + Convert.ToInt32(strArrays2[10]) + Convert.ToInt32(strArrays2[11])) % 10;
                                    int      num13      = (Convert.ToInt32(strArrays2[12]) + Convert.ToInt32(strArrays2[13]) + Convert.ToInt32(strArrays2[14]) + Convert.ToInt32(strArrays2[15])) % 10;
                                    int      num14      = (Convert.ToInt32(strArrays2[16]) + Convert.ToInt32(strArrays2[17]) + Convert.ToInt32(strArrays2[18]) + Convert.ToInt32(strArrays2[19])) % 10;
                                    string   str14      = string.Concat(new object[] { num10, ",", num11, ",", num12, ",", num13, ",", num14 });
                                    (new LotteryDataDAL()).Add(1011, str13, str14, innerText1, string.Join(",", strArrays2));
                                    Public.SetOpenListJson(1011);
                                    LotteryCheck.RunOfIssueNum(1011, str13);
                                    break;
                                }

                                case "phkeno":
                                {
                                    if ((new LotteryDataDAL()).Exists(1015, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays3 = str1.Split(new char[] { ',' });
                                    int      num15      = (Convert.ToInt32(strArrays3[0]) + Convert.ToInt32(strArrays3[1]) + Convert.ToInt32(strArrays3[2]) + Convert.ToInt32(strArrays3[3])) % 10;
                                    int      num16      = (Convert.ToInt32(strArrays3[4]) + Convert.ToInt32(strArrays3[5]) + Convert.ToInt32(strArrays3[6]) + Convert.ToInt32(strArrays3[7])) % 10;
                                    int      num17      = (Convert.ToInt32(strArrays3[8]) + Convert.ToInt32(strArrays3[9]) + Convert.ToInt32(strArrays3[10]) + Convert.ToInt32(strArrays3[11])) % 10;
                                    int      num18      = (Convert.ToInt32(strArrays3[12]) + Convert.ToInt32(strArrays3[13]) + Convert.ToInt32(strArrays3[14]) + Convert.ToInt32(strArrays3[15])) % 10;
                                    int      num19      = (Convert.ToInt32(strArrays3[16]) + Convert.ToInt32(strArrays3[17]) + Convert.ToInt32(strArrays3[18]) + Convert.ToInt32(strArrays3[19])) % 10;
                                    string   str15      = string.Concat(new object[] { num15, ",", num16, ",", num17, ",", num18, ",", num19 });
                                    (new LotteryDataDAL()).Add(1015, str, str15, innerText1, string.Join(",", strArrays3));
                                    Public.SetOpenListJson(1015);
                                    LotteryCheck.RunOfIssueNum(1015, str);
                                    break;
                                }

                                case "bjpk10":
                                {
                                    if ((new LotteryDataDAL()).Exists(4001, str))
                                    {
                                        continue;
                                    }
                                    if ((int)str1.Split(new char[] { ',' }).Length != 10)
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(4001, str, str1, innerText1, "");
                                    Public.SetOpenListJson(4001);
                                    LotteryCheck.RunOfIssueNum(4001, str);
                                    break;
                                }

                                default:
                                {
                                    if (str3 != "shssl")
                                    {
                                        continue;
                                    }
                                    string str16 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 5 || (new LotteryDataDAL()).Exists(3001, str16))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(3001, str16, str1, innerText1, "");
                                    Public.SetOpenListJson(3001);
                                    LotteryCheck.RunOfIssueNum(3001, str16);
                                    break;
                                }
                                }
                            }
                        }
                        string str17 = string.Concat(ConfigurationManager.AppSettings["DataUrl"].ToString(), "hisStory.xml");
                        DirFile.CreateFolder(DirFile.GetFolderPath(false, str17));
                        StreamWriter streamWriter = new StreamWriter(str17, false, Encoding.UTF8);
                        streamWriter.Write(html);
                        streamWriter.Close();
                    }
                    else
                    {
                        (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符3");
                    }
                }
                else
                {
                    (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符1");
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                (new LogExceptionDAL()).Save("采集异常", string.Concat("采集获取开奖数据出错,错误代码111:", exception.Message));
            }
        }
Exemplo n.º 10
0
 public static void QqSsc()
 {
     try
     {
         string text = HtmlOperate2.HttpGet("http://www.77tj.org/api/tencent/onlineim", Encoding.UTF8);
         text = "{\"rows\":10,\"data\":" + text + "}";
         JsonData jsonData = JsonMapper.ToObject(text);
         foreach (JsonData jsonData2 in ((IEnumerable)jsonData["data"]))
         {
             string   text2    = jsonData2["onlinetime"].ToString();
             string   text3    = jsonData2["onlinenumber"].ToString();
             TimeSpan timeSpan = Convert.ToDateTime(text2) - Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
             int      num      = timeSpan.Hours * 60 + timeSpan.Minutes + 1;
             string   str      = string.Concat(num);
             if (num.ToString().Length == 1)
             {
                 str = "000" + num;
             }
             if (num.ToString().Length == 2)
             {
                 str = "00" + num;
             }
             if (num.ToString().Length == 3)
             {
                 str = "0" + num;
             }
             string text4 = DateTime.Now.ToString("yyyyMMdd") + "-" + str;
             if (string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text4) || string.IsNullOrEmpty(text3))
             {
                 new LogExceptionDAL().Save("采集异常", "腾讯分分彩找不到开奖数据的关键字符");
                 break;
             }
             string text5 = text4;
             if (!new LotteryDataDAL().Exists(1005, text5))
             {
                 if (!new LotteryDataDAL().Exists(1005, text5, text3))
                 {
                     int num2 = 0;
                     for (int i = Convert.ToInt32(text3); i > 0; i /= 10)
                     {
                         num2 += i % 10;
                     }
                     string[] value = text3.Split(new char[]
                     {
                         ','
                     });
                     int    num3   = num2 % 10;
                     int    num4   = Convert.ToInt32(text3.Substring(text3.Length - 4, 1));
                     int    num5   = Convert.ToInt32(text3.Substring(text3.Length - 3, 1));
                     int    num6   = Convert.ToInt32(text3.Substring(text3.Length - 2, 1));
                     int    num7   = Convert.ToInt32(text3.Substring(text3.Length - 1, 1));
                     string number = string.Concat(new object[]
                     {
                         num3,
                         ",",
                         num4,
                         ",",
                         num5,
                         ",",
                         num6,
                         ",",
                         num7
                     });
                     new LotteryDataDAL().Add(1005, text5, number, text2, string.Join(",", value));
                     Public.SetOpenListJson(1005);
                     LotteryCheck.RunOfIssueNum(1005, text5);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "腾讯分分彩获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
Exemplo n.º 11
0
        public static void CqSsc()
        {
            try
            {
                string html1 = HtmlOperate.GetHtml(Config.DefaultUrl);
                if (string.IsNullOrEmpty(html1))
                {
                    new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符1");
                }
                else
                {
                    XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
                    if (xmlNode1 == null)
                    {
                        new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符2");
                    }
                    else if (xmlNode1.Count == 0)
                    {
                        new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符3");
                    }
                    else
                    {
                        foreach (XmlNode xmlNode2 in xmlNode1)
                        {
                            string innerText1 = xmlNode2.Attributes["code"].InnerText;
                            string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                            string Number1    = xmlNode2.Attributes["opencode"].InnerText.Replace("+", ",");
                            string innerText3 = xmlNode2.Attributes["opentime"].InnerText;
                            if (string.IsNullOrEmpty(innerText3) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(Number1))
                            {
                                new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符4");
                                return;
                            }
                            bool   flag  = true;
                            string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/hisStory.xml");
                            if (!string.IsNullOrEmpty(html2))
                            {
                                foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                                {
                                    string innerText4 = xmlNode3.Attributes["code"].InnerText;
                                    string innerText5 = xmlNode3.Attributes["expect"].InnerText;
                                    if (innerText4.Equals(innerText1) && innerText5.Equals(innerText2))
                                    {
                                        flag = false;
                                    }
                                }
                            }
                            if (flag && !Number1.Contains("255"))
                            {
                                switch (innerText1)
                                {
                                case "bjpk10":
                                    if (!new LotteryDataDAL().Exists(4001, innerText2))
                                    {
                                        if (Number1.Split(',').Length == 10)
                                        {
                                            new LotteryDataDAL().Add(4001, innerText2, Number1, innerText3, "");
                                            Public.SetOpenListJson(4001);
                                            LotteryCheck.RunOfIssueNum(4001, innerText2);
                                            continue;
                                        }
                                        continue;
                                    }
                                    continue;

                                case "cqssc":
                                    string str1 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1001, str1))
                                    {
                                        new LotteryDataDAL().Add(1001, str1, Number1, innerText3, "");
                                        Public.SetOpenListJson(1001);
                                        LotteryCheck.RunOfIssueNum(1001, str1);
                                        continue;
                                    }
                                    continue;

                                case "gd11x5":
                                    string str2 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2002, str2))
                                    {
                                        new LotteryDataDAL().Add(2002, str2, Number1, innerText3, "");
                                        Public.SetOpenListJson(2002);
                                        LotteryCheck.RunOfIssueNum(2002, str2);
                                        continue;
                                    }
                                    continue;

                                case "jx11x5":
                                    string str3 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2004, str3))
                                    {
                                        new LotteryDataDAL().Add(2004, str3, Number1, innerText3, "");
                                        Public.SetOpenListJson(2004);
                                        LotteryCheck.RunOfIssueNum(2004, str3);
                                        continue;
                                    }
                                    continue;

                                case "krkeno":
                                    if (!new LotteryDataDAL().Exists(1017, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1017, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1017);
                                        LotteryCheck.RunOfIssueNum(1017, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "phkeno":
                                    if (!new LotteryDataDAL().Exists(1015, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1015, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1015);
                                        LotteryCheck.RunOfIssueNum(1015, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "sd11x5":
                                    string str4 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2001, str4))
                                    {
                                        new LotteryDataDAL().Add(2001, str4, Number1, innerText3, "");
                                        Public.SetOpenListJson(2001);
                                        LotteryCheck.RunOfIssueNum(2001, str4);
                                        continue;
                                    }
                                    continue;

                                case "sh11x5":
                                    string str5 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2003, str5))
                                    {
                                        new LotteryDataDAL().Add(2003, str5, Number1, innerText3, "");
                                        Public.SetOpenListJson(2003);
                                        LotteryCheck.RunOfIssueNum(2003, str5);
                                        continue;
                                    }
                                    continue;

                                case "shssl":
                                    string str6 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 5 && !new LotteryDataDAL().Exists(3001, str6))
                                    {
                                        new LotteryDataDAL().Add(3001, str6, Number1, innerText3, "");
                                        Public.SetOpenListJson(3001);
                                        LotteryCheck.RunOfIssueNum(3001, str6);
                                        continue;
                                    }
                                    continue;

                                case "tjssc":
                                    string str7 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1007, str7))
                                    {
                                        new LotteryDataDAL().Add(1007, str7, Number1, innerText3, "");
                                        Public.SetOpenListJson(1007);
                                        LotteryCheck.RunOfIssueNum(1007, str7);
                                        continue;
                                    }
                                    continue;

                                case "twbingo":
                                    if (!new LotteryDataDAL().Exists(1013, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1013, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1013);
                                        LotteryCheck.RunOfIssueNum(1013, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "xdlkl8":
                                    string str8 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (!new LotteryDataDAL().Exists(1011, str8))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1011, str8, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1011);
                                        LotteryCheck.RunOfIssueNum(1011, str8);
                                        continue;
                                    }
                                    continue;

                                case "xjssc":
                                    string str9 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(9);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1003, str9))
                                    {
                                        new LotteryDataDAL().Add(1003, str9, Number1, innerText3, "");
                                        Public.SetOpenListJson(1003);
                                        LotteryCheck.RunOfIssueNum(1003, str9);
                                        continue;
                                    }
                                    continue;

                                default:
                                    continue;
                                }
                            }
                        }
                        string str = ConfigurationManager.AppSettings["DataUrl"].ToString() + "hisStory.xml";
                        DirFile.CreateFolder(DirFile.GetFolderPath(false, str));
                        StreamWriter streamWriter = new StreamWriter(str, false, Encoding.UTF8);
                        streamWriter.Write(html1);
                        streamWriter.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                new LogExceptionDAL().Save("采集异常", "采集获取开奖数据出错,错误代码111:" + ex.Message);
            }
        }
Exemplo n.º 12
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html1 = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, (object)lotteryId));
         if (string.IsNullOrEmpty(html1))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
             if (xmlNode1 == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else if (xmlNode1.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode1)
                 {
                     string innerText1 = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
                         break;
                     }
                     bool   flag  = true;
                     string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/lottery" + (object)lotteryId + ".xml");
                     if (!string.IsNullOrEmpty(html2))
                     {
                         foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                         {
                             if (xmlNode3.Attributes["expect"].InnerText.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string str = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, str))
                         {
                             new LotteryDataDAL().Add(lotteryId, str, innerText3, innerText1, innerText3);
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, str);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }