//public void GetLotteryResult(object param)
        //{
        //    PoolParam par = param as PoolParam;
        //    int lotteryid = par.lottertId;
        //    string lotteryType="";
        //    ConfigHelper.GetLotteryDictionary().TryGetValue(lotteryid, out lotteryType);
        //    List<LotteryIssue> issues = par.LotteryIssues;

        //    //api 请求url
        //    string url = ConfigHelper.BuilderApiUrl(lotteryid);
        //    LogManager.Info("开始调用开奖接口,请求Url=" + url);
        //    //获取开奖结果,如未获取到数据,则轮询指定次数
        //    int whileCount = 0;
        //    while (whileCount < ConfigHelper.GetApiLotteryRound)
        //    {
        //        var result = mHttpHelper.DoGet(url);

        //        if (UpdateLotteryIssueResult(lotteryType, issues, result))
        //            break;//验证,处理成功,跳出循环

        //        whileCount++;//继续循环拉取数据
        //        System.Threading.Thread.Sleep(ConfigHelper.GetApiLotterySleep);
        //    }
        //}

        private void AutoOpenResult(string lotteryCode, string issueCode)
        {
            string key       = lotteryCode + "_" + issueCode;
            bool   iscompled = AutoLotteryC.CreateInstan().Add(key);

            if (!iscompled)
            {
                LogManager.Info(key + "正在运算,跳出再次运算!");
                return;
            }

            var mLotteryIssuesData = new LotteryIssuesData();

            //计算开奖结果
            Ytg.Scheduler.Comm.Bets.FenBetDetailsCalculate betDetailsCalculate = new Ytg.Scheduler.Comm.Bets.FenBetDetailsCalculate();
            string openresult = betDetailsCalculate.Calculate(lotteryCode, issueCode, "");
            bool   compled    = mLotteryIssuesData.UpdateResult(new OpenResultEntity()
            {
                expect   = issueCode,
                opencode = openresult,
                opentime = DateTime.Now
            }, lotteryCode);

            if (compled)
            {
                //移除
                AutoLotteryC.CreateInstan().Remove(key);
                LogManager.Info(key + "运算完成,移除!");
            }
        }
        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));
            }
        }
Example #3
0
        /// <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);
                }
            }
        }
Example #5
0
        public void Execute(IJobExecutionContext context)
        {
            // 这个是彩票编号后编号
            var lottType    = context.Trigger.Key.Group;
            var lotteryCode = context.Trigger.Key.Name;


            var codeArray = lotteryCode.Split(',');

            if (codeArray.Length == 2)
            {
                //08270874
                lotteryCode = codeArray[0];
                LogManager.Info(string.Format("自主开奖开始========={0}==={1}======处理前任务期号{2}", lottType, lotteryCode, lotteryCode));
                //   occDay = codeArray[1];
                //移除code前四位
                lotteryCode = lotteryCode.Remove(0, 4);
                lotteryCode = DateTime.Now.ToString("MMdd") + lotteryCode;
                LogManager.Info(string.Format("自主开奖开始========={0}==={1}======处理后任务期号{2}", lottType, lotteryCode, lotteryCode));
            }

            try
            {
                /**
                 * if (YtgJob.AijFenfenAuto == 1)
                 *      {
                 *          AutoOpenResult(lotteryType, item.expect);
                 *          continue;
                 *      }
                 */
                //if (lotteryCode == "yifencai")
                //{
                //    //一分彩,默认开前一天的数据

                //}
                //else
                //{

                //服务器抓取开奖数据
                string openresult = this.mBetDetailsCalculate.Calculate(lottType, lotteryCode, "");


                //延迟一分钟计算开奖结果


                bool compled = mLotteryIssuesData.UpdateResult(new OpenResultEntity()
                {
                    expect   = lotteryCode,
                    opencode = openresult,
                    opentime = DateTime.Now
                }, lottType);
                // }
            }
            catch (System.Threading.ThreadAbortException ex)
            {
                LogManager.Error("自主开奖ThreadAbortException ", ex);
            }
            catch (Exception ex)
            {
                LogManager.Error("自主开奖 while Exception ", ex);
            }

            LogManager.Info(string.Format("自主开奖结束========={0}==={1}===", lottType, lotteryCode));
        }
Example #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.Text == "福彩3d")
            {
                lotteryCode = "fc3d";
                lotteryid   = 7;
            }
            else if (this.comboBox1.Text == "上海时时乐")
            {
                lotteryCode = "shssl";
                lotteryid   = 8;
            }
            else if (this.comboBox1.Text == "五分11选5")
            {
                lotteryCode = "wf11x5";
                lotteryid   = 18;
            }
            else if (this.comboBox1.Text == "排列三、五")
            {
                lotteryCode = "pl5";
                lotteryid   = 9;
            }
            else if (this.comboBox1.Text == "江苏快三")
            {
                lotteryCode = "jsk3";
                lotteryid   = 22;
            }
            else if (this.comboBox1.Text == "三分11选5")
            {
                lotteryCode = "sf11x5";
                lotteryid   = 17;
            }
            else if (this.comboBox1.Text == "香港六合彩")
            {
                lotteryCode = "hk6";
                lotteryid   = 21;
            }
            else if (this.comboBox1.Text == "广东11选5")
            {
                lotteryCode = "gd11x5";
                lotteryid   = 6;
            }
            else if (this.comboBox1.Text == "埃及分分彩")
            {
                lotteryCode = "FFC1";
                lotteryid   = 13;
            }
            else if (this.comboBox1.Text == "埃及二分彩")
            {
                lotteryCode = "FFC2";
                lotteryid   = 24;
            }
            else if (this.comboBox1.Text == "埃及五分彩")
            {
                lotteryCode = "FFC5";
                lotteryid   = 25;
            }
            else if (this.comboBox1.Text == "重庆时时彩")
            {
                lotteryCode = "cqssc";
                lotteryid   = 1;
            }
            else if (this.comboBox1.Text == "印尼时时彩")
            {
                lotteryCode = "INFFC5";
                lotteryid   = 23;
            }
            else if (this.comboBox1.Text == "河内时时彩")
            {
                lotteryCode = "VIFFC5";
                lotteryid   = 14;
            }
            else if (this.comboBox1.Text == "河内时时彩")
            {
                lotteryCode = "VIFFC5";
                lotteryid   = 14;
            }

            var mLotteryIssuesData = new LotteryIssuesData();

            //计算开奖结果
            Ytg.Scheduler.Comm.Bets.BetDetailsCalculate betDetailsCalculate = new Ytg.Scheduler.Comm.Bets.BetDetailsCalculate();
            string openresult = betDetailsCalculate.Calculate(lotteryCode, this.txtIssue.Text.Trim(), this.txtOpenResult.Text.Trim());

            txtOpenResult.Text = openresult;
            bool compled = mLotteryIssuesData.UpdateResult(new OpenResultEntity()
            {
                expect   = this.txtIssue.Text.Trim(),
                opencode = openresult,
                opentime = DateTime.Now
            }, lotteryCode);
        }