public void DoWork() { //取期号 System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0)); long tt = (DateTime.Now.Ticks - startTime.Ticks) / 10000; var url = string.Format("http://i.sporttery.cn/rank_calculator/get_list?tid[]=77535&&pcode[]=chp&pcode[]=fnl&i_callback=getDataCallBack&_={0}", tt); var encoding = Encoding.GetEncoding("gb2312"); var content = PostManager.Get(url, encoding, 0); content = content.Replace("getDataCallBack({\"data\":", "").Replace(");", "").Replace("}]}", "}]").Trim(); var Ozb_GJList = KaSon.FrameWork.Common.JSON.JsonHelper.Deserialize <List <CupInfo> >(content); var ozb_GJMatchList = new List <CupGJMatchInfo>(); var ozb_GYJMatchList = new List <CupGYJMatchInfo>(); if (Ozb_GJList.Count < 2) { return; } ozb_GJMatchList = Get_OZB_GJMatchList(Ozb_GJList[0]); ozb_GYJMatchList = Get_OZB_GYJMatchList(Ozb_GJList[1]); var newOzb_GJ_List = GetNewSJBList <CupGJMatchInfo>(ozb_GJMatchList, "OZB_GJ"); var newOzb_GYJ_List = GetNewSJBList <CupGYJMatchInfo>(ozb_GYJMatchList, "OZB_GYJ"); #region 发送 欧洲杯冠军数据通知 this.WriteLog("1、开始=>发送欧洲杯冠军数据通知"); var addCupGJMatchList = new List <CupGJMatchInfo>(); var updateCupGJMatchList = new List <CupGJMatchInfo>(); foreach (var r in newOzb_GJ_List) { try { if (r.Key == DBChangeState.Add) { addCupGJMatchList.Add(r.Value); } else { updateCupGJMatchList.Add(r.Value); } } catch (Exception ex) { this.WriteLog(string.Format("向数据库写入 竞彩欧洲杯冠军 数据异常 编号:{0},异常:{1}", r.Value.MatchId, ex.ToString())); } } if (addCupGJMatchList.Count > 0) { var category = (int)NoticeType.JCOZB_GJ; var state = (int)DBChangeState.Add; var param = string.Join("_", (from l in addCupGJMatchList select l.MatchId).ToArray()); var sign = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param)); var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign); //发送 竞彩足球队伍 添加 通知 var innerKey = string.Format("{0}_{1}", "OZB_GJ", "Add"); ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GJ); //ServiceHelper.SendNotice(issuse_Request, (log) => //{ // this.WriteLog(log); //}); } if (updateCupGJMatchList.Count > 0) { var category = (int)NoticeType.JCOZB_GJ; var state = (int)DBChangeState.Update; var param = string.Join("_", (from l in updateCupGJMatchList select l.MatchId).ToArray()); var sign = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param)); var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign); //发送 竞彩足球队伍 修改 通知 var innerKey = string.Format("{0}_{1}", "OZB_GJ", "Update"); ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GJ); //ServiceHelper.SendNotice(issuse_Request, (log) => //{ // this.WriteLog(log); //}); } this.WriteLog("1、发送欧洲杯冠军数据通知 完成"); #endregion #region 发送 欧洲杯冠军数据通知 this.WriteLog("2、开始=>发送欧洲杯冠亚军数据通知"); var addCupGYJMatchList = new List <CupGYJMatchInfo>(); var updateCupGYJMatchList = new List <CupGYJMatchInfo>(); foreach (var r in newOzb_GYJ_List) { try { if (r.Key == DBChangeState.Add) { addCupGYJMatchList.Add(r.Value); } else { updateCupGYJMatchList.Add(r.Value); } } catch (Exception ex) { this.WriteLog(string.Format("向数据库写入 竞彩欧洲杯冠军 数据异常 编号:{0},异常:{1}", r.Value.MatchId, ex.ToString())); } } if (addCupGYJMatchList.Count > 0) { var category = (int)NoticeType.JCOZB_GYJ; var state = (int)DBChangeState.Add; var param = string.Join("_", (from l in addCupGYJMatchList select l.MatchId).ToArray()); var sign = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param)); var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign); //发送 竞彩足球队伍 添加 通知 var innerKey = string.Format("{0}_{1}", "OZB_GYJ", "Add"); ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GYJ); //ServiceHelper.SendNotice(issuse_Request, (log) => //{ // this.WriteLog(log); //}); } if (updateCupGYJMatchList.Count > 0) { var category = (int)NoticeType.JCOZB_GYJ; var state = (int)DBChangeState.Update; var param = string.Join("_", (from l in updateCupGYJMatchList select l.MatchId).ToArray()); var sign = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param)); var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign); //发送 竞彩足球队伍 修改 通知 var innerKey = string.Format("{0}_{1}", "OZB_GYJ", "Update"); ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GYJ); //ServiceHelper.SendNotice(issuse_Request, (log) => //{ // this.WriteLog(log); //}); } this.WriteLog("2、发送欧洲杯冠亚军数据通知 完成"); #endregion }