public ActionResult CustomRun(int customTime, string matchIdList) { ResponesJson jsonResp = new ResponesJson(); try { var matches = InitMatchList(); //指定賽事資料 string[] matchArray = matchIdList.Split(','); List <long> checklist = new List <long>(); foreach (var id in matchArray) { checklist.Add(long.Parse(id)); } //checklist.Add(13854605); //checklist.Add(13649001); List <long> mlist = new List <long>(); foreach (var matchid in checklist) { if (matches.Contains(matchid)) { mlist.Add(matchid); } } if (mlist.Count == 0) { Log.Info($"無賽事走地與賠率資料"); jsonResp.Success = false; jsonResp.ResultData = "無賽事走地與賠率資料"; return(Content(JsonConvert.SerializeObject(jsonResp))); } Nami.Delay(1).Seconds().Do(() => { foreach (var matchid in mlist) { if (!CacheTool.ThreadExist(matchid) && CacheTool.MatchList.Count < 5) { Log.Info($"即將重播 {matchid} 場的賽事走地與賠率資料"); new MatchV1(matchid, customTime).BetRadarStart(); } } }); jsonResp.Success = true; jsonResp.ResultData = RefreshList(); } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }
public ActionResult RefreshExecuteList() { ResponesJson jsonResp = new ResponesJson(); try { jsonResp.Success = true; jsonResp.ResultData = RefreshList(); } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }
public ActionResult MatchListGet(string matchDate) { ResponesJson jsonResp = new ResponesJson(); try { if (matchDate.Length != 10) { jsonResp.Success = false; jsonResp.ResultData = $"日期格式不對(yyyy-MM-dd) => {matchDate}"; } var matchList = DataSave.MatchListGet(matchDate); jsonResp.Success = true; jsonResp.ResultData = matchList; } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }
public ActionResult RadomRun(int randomTime, int randomCnt) { ResponesJson jsonResp = new ResponesJson(); try { List <long> mlist = new List <long>(); var matches = InitMatchList(); Random rand = new Random(Guid.NewGuid().GetHashCode()); List <int> listLinq = new List <int>(Enumerable.Range(0, matches.Count() - 1)); listLinq = listLinq.OrderBy(num => rand.Next()).ToList <int>(); for (int i = 0; i < randomCnt; i++) { mlist.Add(matches[listLinq[i]]); } Nami.Delay(1).Seconds().Do(() => { foreach (var matchid in mlist) { if (!CacheTool.ThreadExist(matchid) && CacheTool.MatchList.Count < 5) { Log.Info($"即將重播 {matchid} 場的賽事走地與賠率資料"); new Match(matchid, randomTime).BetRadarStart(); } } }); jsonResp.Success = true; jsonResp.ResultData = RefreshList(); } catch (Exception ex) { jsonResp.ResultData = ex.Message; jsonResp.Success = false; } return(Content(JsonConvert.SerializeObject(jsonResp))); }