private async System.Threading.Tasks.Task CsgoPay() { var csgo = new GameAutoPayRepository().getCsgoList(); foreach (var c in csgo) { try { CSGOMatches.RootObject getm = await new CSGORepository().GetCSGOMatches((int)c.AutoSn); var gt = (DateTime)getm.end_at; if (getm.end_at == null && gt.AddMinutes(15) > DateTime.Now) { continue; } var game = await new GamesRepository().GetALLAutoGameList(); //var game = await new GamesRepository().GetGameDetail(c.GameSn); var g = game.Where(p => p.sn == c.GameSn).FirstOrDefault(); if (g.gameStatus != 4) { continue; } await new AutoPayController().pays(c.GameSn); } catch (Exception e) { Console.WriteLine(e); } try { //發送至gti string url = "http://funbet.games/Account/BearAutoPayLoginByURL"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; string result = null; string param = "par=vnTy73o73S6DInB9blni0jLxdfSZO%2BxbU9/dyY4VcUr9rCNcS9ErKMzWjixZlA6CPATa9f8aKtLqASTHeb7xKnoqPOrCD34odGD2w1jmr2NaMycREjIlJe0bUdfD8qcx&bearid=" + c.sn.ToString(); byte[] bs = Encoding.ASCII.GetBytes(param); using (Stream reqStream = request.GetRequestStream()) { reqStream.Write(bs, 0, bs.Length); } using (WebResponse response = request.GetResponse()) { StreamReader sr = new StreamReader(response.GetResponseStream()); result = sr.ReadToEnd(); sr.Close(); } } catch { } } }
private async System.Threading.Tasks.Task autoCsgoTime() { var csgo = new GameAutoPayRepository().getCsgoNoTimeList(); foreach (var c in csgo) { await updateTimeAsync(c); } }
private async System.Threading.Tasks.Task autoCsgoPay() { var csgo = new GameAutoPayRepository().getCsgoList(); foreach (var c in csgo) { CSGOMatches.RootObject getm = await new CSGORepository().GetCSGOMatches((int)c.AutoSn); var allgame = new List<CSGOGame.RootObject>(); foreach (var m in getm.games) { CSGOGame.RootObject getg = await new CSGORepository().GetCSGOGame(m.id); allgame.Add(getg); } await new AutoPayController().CSGOSetAnswer(c.sn, allgame, getm); } }
public async System.Threading.Tasks.Task <ActionResult> TimeUpdate() { var csgo = new GameAutoPayRepository().getCsgoNoTimeList(); foreach (var c in csgo) { try { //var game = await new GamesRepository().GetGameDetail(c.GameSn); CSGOMatches.RootObject getm = await new CSGORepository().GetCSGOMatches((int)c.AutoSn); //更新時間日期 var gpm = await new gameController().AutoEdit(c.sn); if (gpm.gamepost.edate != getm.begin_at) { gpm.gamepost.edate = getm.begin_at; gpm.game.edate = getm.begin_at; gpm.game.gamedate = getm.begin_at; foreach (var t in gpm.game.topicList) { t.edate = getm.begin_at; } await new gameController().AutoEdit(gpm); } } catch (Exception e) { Console.WriteLine(e); } } return(View()); }
public async System.Threading.Tasks.Task <ActionResult> SetPay() { var csgo = new GameAutoPayRepository().getCsgoList(); foreach (var c in csgo) { try { //var game = await new GamesRepository().GetGameDetail(c.GameSn); CSGOMatches.RootObject getm = await new CSGORepository().GetCSGOMatches((int)c.AutoSn); var gbat = (DateTime)getm.begin_at; /*if (getm.end_at == null) * { * if (gbat.AddHours(3) < DateTime.Now) * await updateTimeAsync(c); * * continue; * }*/ var game = await new GamesRepository().GetALLAutoGameList(); var g = game.Where(p => p.sn == c.GameSn).FirstOrDefault(); if (g.gameStatus == 4 || g.gameStatus == 3) { continue; } var allgame = new List <CSGOGame.RootObject>(); foreach (var m in getm.games) { CSGOGame.RootObject getg = await new CSGORepository().GetCSGOGame(m.id); allgame.Add(getg); } if (getm.number_of_games > 2) { if (allgame[0].rounds.Count() == 0 || allgame[1].rounds.Count() == 0 || allgame.Count() == 0 || getm.winner.name == null) { continue; } } else if (getm.number_of_games == 1) { if (allgame[0].rounds.Count() == 0 || getm.winner.name == null || allgame.Count() == 0) { continue; } } else if (getm.number_of_games == 2) { if (allgame[0].rounds.Count() == 0 || allgame[1].rounds.Count() == 0 || allgame.Count() == 0) { continue; } } await CSGOSetAnswer(c.sn, allgame, getm); } catch (Exception e) { Console.WriteLine(e); } } return(View()); }
private async System.Threading.Tasks.Task autoCsgoPay() { var csgo = new GameAutoPayRepository().getCsgoList(); foreach (var c in csgo) { try { //var game = await new GamesRepository().GetGameDetail(c.GameSn); CSGOMatches.RootObject getm = await new CSGORepository().GetCSGOMatches((int)c.AutoSn); var gbat = (DateTime)getm.begin_at; var gedate = (DateTime)c.edate; if (getm.end_at == null) { if (gedate.AddHours(3) < DateTime.Now) { await updateTimeAsync(c); } continue; } else { var getmend = (DateTime)getm.end_at; if (getmend.AddMinutes(10) > DateTime.Now) { continue; } } var game = await new GamesRepository().GetALLAutoGameList(); var g = game.Where(p => p.sn == c.GameSn).FirstOrDefault(); if (g.gameStatus == 4 || g.gameStatus == 3) { continue; } var allgame = new List <CSGOGame.RootObject>(); foreach (var m in getm.games) { CSGOGame.RootObject getg = await new CSGORepository().GetCSGOGame(m.id); allgame.Add(getg); } if (getm.detailed_stats == true) { if (getm.number_of_games > 2) { if (allgame[0].finished == false || allgame[1].finished == false || allgame.Count() == 0 || getm.winner.name == null || allgame[1].rounds_score == null) { continue; } } else if (getm.number_of_games == 1) { if (allgame[0].rounds.Count() == 0 || getm.winner.name == null || allgame.Count() == 0) { continue; } } else if (getm.number_of_games == 2) { if (allgame[0].rounds.Count() == 0 || allgame[1].rounds.Count() == 0 || allgame.Count() == 0) { continue; } } } else { if (getm.number_of_games > 2) { if (allgame.Count() == 0 || getm.winner.name == null) { continue; } } else if (getm.number_of_games == 1) { if (getm.winner.name == null || allgame.Count() == 0) { continue; } } else if (getm.number_of_games == 2) { if (allgame.Count() == 0) { continue; } } } await new AutoPayController().CSGOSetAnswer(c.sn, allgame, getm); } catch (Exception e) { Console.WriteLine(e); } } }