private static void IntoSql(Online o) { string lotteryType = "tenct"; int lotteryid = 11; bool isCompled = mLotteryIssuesData.UpdateResult(new OpenResultEntity() { expect = o.issue, opencode = o.result, opentime = DateTime.Now }, lotteryid);//保存开奖结果 if (isCompled) { //取消延迟开奖 mBetDetailsCalculate.Calculate(lotteryType, o.issue, o.result);//计算投注明细中奖金额 LogManager.Info(string.Format("计算开奖成功: type={0},lotteryCode={1}", lotteryType, lotteryType)); } }
/// <summary> /// 调用服务 去更新数据库开奖结果表 /// </summary> /// <param name="lotteryCode"></param> /// <param name="issueCode"></param> /// <param name="openResult"></param> /// <param name="openTime"></param> /// <returns></returns> private bool UpdateLotteryIssueResult(string lotteryCode, string lotteryType, List <OpenResultEntity> result) { if (null == result || result.Count < 1) { return(false); } OpenResultEntity curItem = null; foreach (var item in result) { try { if (lotteryType.ToLower() == "bjkl8" && item.opencode.IndexOf('+') != -1) { //北京快乐8,去掉飞盘 item.opencode = item.opencode.Split('+')[0]; } if (item.expect.Trim() == lotteryCode.Trim()) { curItem = item; break; } } catch (Exception ex) { LogManager.Error("OpenLotteryResultJob->UpdateLotteryIssueResult异常", ex); } } if (curItem == null) { return(false); } bool isCompled = mLotteryIssuesData.UpdateResult(curItem, lotteryType); if (isCompled) { mBetDetailsCalculate.Calculate(lotteryType, curItem.expect, curItem.opencode);//计算投注明细中奖金额 LogManager.Info(string.Format("同步数据库成功: type={0},lotteryCode={1}", lotteryType, lotteryCode)); } return(isCompled); }
/// <summary> /// 调用服务 去更新数据库开奖结果表 /// </summary> /// <param name="lotteryCode"></param> /// <param name="issueCode"></param> /// <param name="openResult"></param> /// <param name="openTime"></param> /// <returns></returns> public void UpdateLotteryIssueResult(object obj) { PoolParam param = obj as PoolParam; int lotteryid = param.lotteryid; List <OpenResultEntity> result = param.LotteryIssues; string lotteryType = ""; ConfigHelper.GetLotteryDictionary().TryGetValue(lotteryid, out lotteryType); var lotteryIssuesData = new LotteryIssuesData(); var betDetailsCalculate = new BetDetailsCalculate(); foreach (var item in result) { AutoSubmit.AutoSubmitBetting.Run(lotteryType); try { if (lotteryType == "tenct") { // if (YtgJob.AijFenfenAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "FFC1") { if (YtgJob.AiJErFenAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "twbingo") { if (YtgJob.AiJWuFenAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "krkeno") { if (YtgJob.Hg15Auto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "VIFFC5") { if (YtgJob.HeNeWuFenAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "INFFC5") { if (YtgJob.YiNiWuFenAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } else if (lotteryType == "xjssc") { if (YtgJob.tjAuto == 1) { AutoOpenResult(lotteryType, item.expect); continue; } } if (lotteryType.ToLower() == "bjkl8" && item.opencode.IndexOf('+') != -1) { //北京快乐8,去掉飞盘 item.opencode = item.opencode.Split('+')[0]; } else if (lotteryType.ToLower() == "krkeno" || lotteryType.ToLower() == "twbingo") { //韩国1.5分彩 //01,04,05,08, //10,11,14,15, //20,22,23,26, //29,31,34,43, //57,61,73,79 //08,09,13,16, //17,19,23,27, //30,34,49,51, //54,56,59,60, //68,73,74,79 + 08 if (item.opencode.IndexOf('+') >= 0) { item.opencode = item.opencode.Split('+')[0]; } var codeArray = item.opencode.Split(',');//开奖结果 if (codeArray.Length != 20) { return; } //四位计算和值尾数 var newCode = GetSumLastNum(codeArray.Skip(0).Take(4).ToArray()) + "," + GetSumLastNum(codeArray.Skip(4).Take(4).ToArray()) + "," + GetSumLastNum(codeArray.Skip(8).Take(4).ToArray()) + "," + GetSumLastNum(codeArray.Skip(12).Take(4).ToArray()) + "," + GetSumLastNum(codeArray.Skip(16).Take(4).ToArray()); item.opencode = newCode; } LogManager.Error("******************获取开奖结果 lotteryid=" + lotteryid + "***opencode=" + item.opencode + "**************"); bool isCompled = lotteryIssuesData.UpdateResult(item, lotteryid);//保存开奖结果 if (isCompled) { //取消延迟开奖 //if (DelayOpenLotteryCodes.Contains(lotteryType)) //{ // System.Threading.Thread.Sleep(1000 * 30); //} betDetailsCalculate.Calculate(lotteryType, item.expect, item.opencode);//计算投注明细中奖金额 LogManager.Info(string.Format("计算开奖成功: type={0},lotteryCode={1}", lotteryType, item.expect)); } } catch (Exception ex) { LogManager.Error("OpenLotteryResultJob->UpdateLotteryIssueResult异常", ex); } } }