private void CheckLotteryResult() { LogHelper.Info("CheckResult", "TaskBase", "漏开奖检测 Begin"); Schedule(() => { TimeSpan startTime = DateTime.Parse("08:00").TimeOfDay; TimeSpan endTime = DateTime.Parse("23:59").TimeOfDay; TimeSpan tmNow = DateTime.Now.TimeOfDay; if ((tmNow >= startTime && tmNow <= endTime) || (tmNow > DateTime.Parse("00:00").TimeOfDay&& tmNow < DateTime.Parse("04:00").TimeOfDay)) { string codes = ""; CommonBusiness.LottertList.ForEach(x => { codes += x.CPCode + ","; }); TaskService.BasService.UpdByStatusAndOpenTime(codes, DateTime.Now.AddSeconds(-30).ToString("yyyy-MM-dd hh:mm:ss")); foreach (var item in CommonBusiness.LottertList) { KCWBase <DataResult> kcwresult = ProTools.HttpRequest.RequestServer <KCWBase <DataResult> >(ProTools.KCWAppUrl.NewLy, Getparas(item.CPCode.ToUpper(), 20)); if (kcwresult != null && kcwresult.Data.Count > 0) { var suc = TaskService.BasService.OpenLotteryResult(kcwresult.Data[0].OpenCode.Replace(',', ' '), kcwresult.Data[0].Expect, item.CPCode.ToUpper()); LogHelper.Info("CheckResult", "TaskBase", item.CPCode.ToUpper() + "楼开奖检测 " + kcwresult.Data[0].Expect + (suc ? "开奖成功!" : "开奖失败") + " End"); } } } }).NonReentrant().WithName("[CheckLotteryResult]").ToRunNow().AndEvery(1).Hours(); }
private void UpdateXJSSCResult() { LogHelper.Info("UpdateResult", "TaskBase", "XJSSC Begin"); Schedule(() => { TimeSpan startTime = DateTime.Parse("09:09").TimeOfDay; TimeSpan endTime = DateTime.Parse("23:02").TimeOfDay; TimeSpan tmNow = DateTime.Now.TimeOfDay; if (tmNow >= startTime && tmNow <= endTime) { lock (xjlock) { KCWBase <DataResult> kcwresult = ProTools.HttpRequest.RequestServer <KCWBase <DataResult> >(ProTools.KCWAppUrl.NewLy, Getparas("XJSSC")); if (kcwresult != null && kcwresult.Data.Count > 0) { var suc = TaskService.BasService.OpenLotteryResult(kcwresult.Data[0].OpenCode.Replace(',', ' '), kcwresult.Data[0].Expect, "XJSSC"); LogHelper.Info("UpdateResult", "TaskBase", "XJSSC:" + kcwresult.Data[0].Expect + (suc ? "开奖成功!" : "开奖失败") + " End"); } else { LogHelper.Info("UpdateResult", "TaskBase", "XJSSC End"); } } } }).NonReentrant().WithName("[UpdateXJSSCResult]").ToRunNow().AndEvery(1).Minutes(); }