123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using FCS.Common;
- using FCS.Crawler.ZCLotteryAgainst;
- using FCS.Crawler.ZCLotteryAsianDish;
- using FCS.Crawler.ZCLotteryGames;
- using FCS.Crawler.ZCLotteryGrouping;
- using FCS.Crawler.ZCLotteryIP;
- using FCS.Crawler.ZCLotteryMatchs;
- using FCS.Crawler.ZCLotteryScore;
- using FCS.Crawler.ZCLotterySizeIndex;
- using FCS.Crawler.ZCLotteryTeam;
- using FCS.Interface;
- using FCS.Models;
- using Quartz;
- namespace FCS.Crawler
- {
- public class Update_RealTimeJobCeshi : CommonJob, IJob
- {
- public void Execute(IJobExecutionContext context)
- {
- Config = CommonHelper.GetConfigFromDataMap(context.JobDetail.JobDataMap);
- Click();
- }
- public void Click()
- {
- ThreadPool.SetMaxThreads(500, 500);
- CommonHelper.LogBD("Update_RealTimeJobCeshi", "Update_RealTimeJobCeshi");
- Trace.WriteLine("Update_RealTimeJobCeshi" + DateTime.Now);
- List<int> rlist = new List<int>();
- //概率
- //var query = services.Query_delete<F_Compensate>("(select * from (select COUNT(GameId) as PK,GameId,BankerCompanyId,CompensateType from F_Compensate where CompensateType='20f77e31d96ae811ab3100ac6a4a134f' group by GameId,BankerCompanyId,CompensateType) as a where a.PK>1)").ToList();
- //for (int i = 0; i < query.Count(); i++)
- //{
- // services.Delete<F_Compensate>(@" and BankerCompanyId = '" + query[i].BankerCompanyId + "' and GameId = '" + query[i].GameId + "' and CompensateType = '" + query[i].CompensateType + "' and PK not in (select top 1 PK from F_Compensate where BankerCompanyId = '" + query[i].BankerCompanyId + "' and GameId = '" + query[i].GameId + "' and CompensateType = '" + query[i].CompensateType + "' order by CreateDateTime desc)");
- //}
- //foreach (var item in query)
- //{
- // //delete F_Compensate where GameId='' and BankerCompanyId='' and CompensateType='' and PK not in (select top 1 PK from F_Compensate where GameId='' and BankerCompanyId='' and CompensateType='' order by CreateDateTime desc)
- // services.Delete<F_Compensate>(@" and BankerCompanyId = '" + item.BankerCompanyId+ "' and GameId = '"+item.GameId+ "' and CompensateType = '"+item.CompensateType+"' and PK not in (select top 1 PK from F_Compensate where BankerCompanyId = '" + item.BankerCompanyId+ "' and GameId = '"+item.GameId+ "' and CompensateType = '"+item.CompensateType+"' order by CreateDateTime desc)");
- // //for (int i = 0; i < querylist.Count; i++)
- // //{
- // // if (i == 0)
- // // continue;
- // // rlist.Add(querylist[i].PK);
- // //}
- //}
- //if (rlist.Count > 0)
- //{
- // int pg = rlist.Count % 1000 == 0 ? rlist.Count / 1000 : rlist.Count / 1000 + 1;
- // for (int i = 0; i < pg; i++)
- // {
- // var listint1 = rlist.Skip(i * 1000).Take(1000).ToList();
- // string sql = "delete F_Compensate where PK in (" + string.Join(",", listint1) + ")";
- // CommonHelper.LogBD(sql, "Update_RealTimeJobCeshi");
- // //services.Delete<F_Compensate>(" and PK in (" + string.Join(",", listint1) + ")");
- // }
- //}
- rlist = new List<int>();
- //凯利指数
- var query = services.Query_delete<F_Compensate>("(select * from (select COUNT(GameId) as PK,GameId,BankerCompanyId,CompensateType from F_Compensate where CompensateType='21f77e31d96ae811ab3100ac6a4a134f' group by GameId,BankerCompanyId,CompensateType) as a where a.PK>1)").ToList();
- foreach (var item in query)
- {
- var querylist = services.Query<F_Compensate>(" and BankerCompanyId='" + item.BankerCompanyId + "' and GameId='" + item.GameId + "' and CompensateType='" + item.CompensateType + "'").OrderByDescending(a => a.CreateDateTime).ToList();
- for (int i = 0; i < querylist.Count; i++)
- {
- if (i == 0)
- continue;
- rlist.Add(querylist[i].PK);
- }
- }
- //赔付率
- query = services.Query_delete<F_Compensate>("(select * from (select COUNT(GameId) as PK,GameId,BankerCompanyId,CompensateType from F_Compensate where CompensateType='a1bfa33cd96ae811ab3100ac6a4a134f' group by GameId,BankerCompanyId,CompensateType) as a where a.PK>1)").ToList();
- foreach (var item in query)
- {
- var querylist = services.Query<F_Compensate>(" and BankerCompanyId='" + item.BankerCompanyId + "' and GameId='" + item.GameId + "' and CompensateType='" + item.CompensateType + "'").OrderByDescending(a => a.CreateDateTime).ToList();
- for (int i = 0; i < querylist.Count; i++)
- {
- if (i == 0)
- continue;
- rlist.Add(querylist[i].PK);
- }
- }
- if (rlist.Count > 0)
- {
- for (int i = 0; i < rlist.Count(); i++)
- {
- services.Delete<F_Compensate>(" and PK = " + rlist[i] + "");
- }
- //foreach (var item in rlist)
- //{
- // services.Delete<F_Compensate>(" and PK = "+item+"");
- //}
- //int pg = rlist.Count % 1000 == 0 ? rlist.Count / 1000 : rlist.Count / 1000 + 1;
- //for (int i = 0; i < pg; i++)
- //{
- // var listint1 = rlist.Skip(i * 1000).Take(1000).ToList();
- // string sql = "delete F_Compensate where PK in (" + string.Join(",", listint1) + ")";
- // CommonHelper.LogBD(sql, "Update_RealTimeJobCeshi");
- // //services.Delete<F_Compensate>(" and PK in (" + string.Join(",", listint1) + ")");
- //}
- }
- //List<int> rlist = new List<int>();
- //var querygame = services.Query<F_Games>().ToList();
- //querygame = new List<F_Games>();
- ////var q1 = querygame.Where((x, i) => querygame.FindIndex(z => z.HomeTeamId == x.HomeTeamId&& z.VisitingTeamId == x.VisitingTeamId && z.StartDateTime == x.StartDateTime && z.GroupingId == x.GroupingId && z.Season == x.Season) == i).ToList();//Lambda表达式去重
- ////var q1 = querygame.OrderBy(a => a.CreateDateTime).GroupBy(p => new { p.HomeTeamId, p.VisitingTeamId, p.StartDateTime, p.GroupingId }).Select(g => g.Last()).ToList();
- ////foreach (var item in querygame)
- ////{
- //// if (q1.Where(a => a.PK == item.PK).ToList().Count > 0)
- //// {
- //// continue;
- //// }
- //// else
- //// {
- //// rlist.Add(item.PK);
- //// }
- ////}
- ////if (rlist.Count > 0)
- ////{
- //// int pg = rlist.Count % 10000 == 0 ? rlist.Count / 10000 : rlist.Count / 10000 + 1;
- //// for (int i = 0; i < pg; i++)
- //// {
- //// var listint1 = rlist.Skip(i * 10000).Take(10000).ToList();
- //// services.Delete<F_Games>(" and PK in (" + string.Join(",", listint1) + ")");
- //// }
- ////}
- //rlist = new List<int>();
- //var q2 = querygame.OrderBy(a => a.CreateDateTime).GroupBy(p => new { p.HomeTeamId, p.VisitingTeamId,p.GroupingId }).Select(g => g.Last()).ToList();
- //foreach (var item in q2)
- //{
- // if (querygame.Where(a => a.HomeTeamId == item.HomeTeamId && a.VisitingTeamId == item.VisitingTeamId && a.GroupingId == item.GroupingId).ToList().Count > 1)
- // {
- // var q3 = querygame.Where(a => a.HomeTeamId == item.HomeTeamId && a.VisitingTeamId == item.VisitingTeamId && a.GroupingId == item.GroupingId).ToList();
- // foreach (var item1 in q3)
- // {
- // if (item1.PK != item.PK)
- // {
- // rlist.Add(item.PK);
- // }
- // }
- // }
- //}
- //if (rlist.Count > 0)
- //{
- // int pg = rlist.Count % 10000 == 0 ? rlist.Count / 10000 : rlist.Count / 10000 + 1;
- // for (int i = 0; i < pg; i++)
- // {
- // var listint1 = rlist.Skip(i * 10000).Take(10000).ToList();
- // services.Delete<F_Games>(" and PK in (" + string.Join(",", listint1) + ")");
- // }
- //}
- CommonHelper.LogBD("获取完Update_RealTimeJobToDay10", "Update_RealTimeJobCeshi");
- Trace.WriteLine("获取完Update_RealTimeJobToDay10" + DateTime.Now);
- }
- }
- }
|