/// <summary> /// 真正操作逻辑 /// </summary> private void DoSomething() { string config = ConfigHelper.GetValue("AutoAddNewestLottery"); if (!string.IsNullOrEmpty(config)) { string[] arr = config.Split(",".ToCharArray()); foreach (string s in arr) { bool isSucc = Enum.TryParse <SCCLottery>(s, true, out SCCLottery type); //SCCLottery type = (SCCLottery)Enum.Parse(typeof(SCCLottery), arg.EnumCode, true); if (!isSucc) { continue; } //官网最新期数 string latestaward = GrabTheLatestAwardManager.GetTheLatestAward(type); if (!string.IsNullOrEmpty(latestaward)) { //处理期数 latestaward = latestaward.IndexOf("20", 0, 2, StringComparison.Ordinal) >= 0 ? latestaward : "20" + latestaward; //本地最新期数 string old = (qgfc3Dbll.GetNewTermByTableName(type.GetSCCLotteryTableName()).TryToInt32() - 1).ToString(); StringBuilder builder = new StringBuilder(); //TODO 检测二者之间差了多少期,并将差了的期插入本地 int o = old.TryToInt32(); int l = latestaward.TryToInt32(); if (o < l) { while (o + 1 <= l) { o++; //向本地插入一条不包括开奖号的数据 int totalBall = string.IsNullOrEmpty(type.GetEnumText()) ? 0 : type.GetEnumText().TryToInt32(); //插入差额期数 Insert(totalBall, o.ToString(), type); builder.Append(o.ToString() + "、"); } //TODO 插入下一期开奖信息并且发送邮件对未复查的进行提醒 SendEmail(StringHelper.DelLastChar(builder.ToString(), "、"), type); } } } } }
/// <summary> /// 插入下一期开奖信息并且发送邮件对未复查的进行提醒 /// </summary> /// <param name="latestaward"></param> /// <param name="scc"></param> private void SendEmail(string latestaward, SCCLottery scc) { //发送邮件 string address = ConfigHelper.GetValue("ErrorReportTo"); string subject = scc.GetEnumDescription() + "[第" + latestaward + "期]开奖号未及时复查提醒"; string body = "系统管理员请注意:" + scc.GetEnumDescription() + "[第" + latestaward + "期]开奖号未及时复查,请尽快登陆系统后台进行复查操作!<br /><br />" + scc.GetEnumDescription() + "官方参考网址为:<a href='" + GrabTheLatestAwardManager.GetRequestUrlAndXPath(scc)[0] + "'>【点我前往】</a>"; MailHelper.SendByThread(address, subject, body); //同时插入下一期 //int totalBall = string.IsNullOrEmpty(scc.GetEnumText()) ? 0 : scc.GetEnumText().TryToInt32(); //string[] arr = latestaward.Split("、".ToCharArray()); //Insert(totalBall, (arr[arr.Length - 1].TryToInt32() + 1).ToString(), scc); }