Example #1
0
        /// <summary>
        /// 添加初始记录
        /// </summary>
        /// <returns></returns>
        public static void InitCanadaLottery()
        {
            string root = ConfigurationManager.AppSettings["lk28"];

            lock (lkinit)
            {
                string    url      = root + "?token=7904a63f2fc9c2d2&code=cakeno&rows=5&format=json&date=" + DateTime.Now.ToString("yyyy-MM-dd");
                string    bjjson   = HttpUtils.HttpGet(url, "");
                MD_28Json bj28json = JsonConvert.DeserializeObject <MD_28Json>(bjjson);
                if (bj28json.data.Count > 0)
                {
                    LK28Item item = bj28json.data[0];
                    //已经开奖的记录是否存在,存在则不添加,不存在则添加
                    bool extbj = Lottery.ExistsCanada28(" and a.expect='" + (int.Parse(item.expect + 1)).ToString() + "'");
                    if (!extbj)
                    {
                        MD_Lottery lottery = new MD_Lottery
                        {
                            Type     = 11,
                            Expect   = (int.Parse(item.expect) + 1).ToString(),
                            Opentime = DateTime.Parse(item.opentime).AddMinutes(3).AddSeconds(30),
                            Status   = 0
                        };
                        bool result = Lottery.AddCanadaRecord(lottery);
                    }
                }
            }
        }
Example #2
0
        /*
         * 彩票逻辑:投注3:30s 封盘 30s ,到时(每期规定的开奖时间)增加新的投注记录,开奖
         */
        public void Execute()
        {
            //执行获取加拿大卑斯快乐8 开奖结果并计算出加拿大28开奖
            lock (lkcanadalk)
            {
                try
                {
                    TimeSpan startTime = DateTime.Parse(start).TimeOfDay;
                    TimeSpan endTime   = DateTime.Parse(end).TimeOfDay;
                    TimeSpan tmNow     = DateTime.Now.TimeOfDay;

                    if (tmNow < startTime || tmNow > endTime)
                    {
                        //每3:30一次
                        string expect = Lottery.AddCanadaLottery();
                        if (expect != string.Empty)
                        {
                            MD_WaitPayBonus pay = new MD_WaitPayBonus {
                                Expect = expect, Isread = false
                            };
                            Lottery.AddWaitPay(pay);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogClass.Log.WriteLogs("", "", "", "执行加拿大28异常:" + ex.Message, root + @"\service\can28\", false);
                }
            }
        }
Example #3
0
        public void Execute()
        {
            //执行获取北京快乐8 开奖结果并计算出北京28开奖
            lock (lkbjlk)
            {
                try
                {
                    TimeSpan startTime = DateTime.Parse(start).TimeOfDay;
                    TimeSpan endTime   = DateTime.Parse(end).TimeOfDay;
                    TimeSpan tmNow     = DateTime.Now.TimeOfDay;

                    if (tmNow >= startTime && tmNow <= endTime)
                    {
                        if (tmNow.Minutes % 5 == 0)
                        {
                            //获取开奖结果
                            string expect = Lottery.AddLottery();
                            if (expect != string.Empty)
                            {
                                MD_WaitPayBonus pay = new MD_WaitPayBonus {
                                    Expect = expect, Isread = false
                                };
                                Lottery.AddWaitPay(pay);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogClass.Log.WriteLogs("", "", "", "执行北京28异常:" + ex.Message, root + @"\service\bj28\", false);
                }
            }
        }
Example #4
0
 /*
  * 计算奖金
  */
 public void Execute()
 {
     lock (lkresult)
     {
         Lottery.ExcuteBettResult();
     }
 }
Example #5
0
        /// <summary>
        /// 根据加拿大卑斯快乐8结果,计算28结果
        /// </summary>
        /// <returns></returns>
        public static void TrapCanada()
        {
            lock (lkcan)
            {
                string    root         = ConfigurationManager.AppSettings["lk28"];
                string    url          = root + "?token=7904a63f2fc9c2d2&code=cakeno&rows=15&format=json&date=" + DateTime.Now.ToString("yyyy-MM-dd");
                string    bjjson       = HttpUtils.HttpGet(url, "");
                MD_28Json cakeno28json = JsonConvert.DeserializeObject <MD_28Json>(bjjson);
                if (cakeno28json.data.Count > 0)
                {
                    string allnums = string.Empty;
                    cakeno28json.data.ForEach((x) =>
                    {
                        allnums += "'" + x.expect + "',";
                    });
                    allnums = allnums.Remove(allnums.Length - 1, 1);
                    //10 北京28  11 加拿大28
                    List <MD_Lottery> listlott = Lottery.GetLotteryList(1, -1, " where a.type=11 and a.expect in (" + allnums + ") and a.status in (0,1) and DATEDIFF(minute,a.opentime,getdate())>1");
                    if (listlott.Count > 0)
                    {
                        foreach (MD_Lottery lot in listlott)
                        {
                            LK28Item mdlt = cakeno28json.data.Find(x => x.expect == lot.Expect);

                            //更新开奖信息
                            MD_Lottery lottery = new MD_Lottery
                            {
                                Type     = 11,
                                Expect   = mdlt.expect,
                                Opencode = mdlt.opencode,
                                Opentime = DateTime.Parse(mdlt.opentime),
                                Status   = 2
                            };

                            GetCanaResult(lottery, mdlt);

                            string result = OWZX.Data.Lottery.UpdateLottery(lottery);
                            if (result.EndsWith("成功"))
                            {
                                if (mdlt.expect != string.Empty)
                                {
                                    MD_WaitPayBonus pay = new MD_WaitPayBonus {
                                        Expect = mdlt.expect, Isread = false
                                    };
                                    Lottery.AddWaitPay(pay);
                                }
                            }
                            else
                            {
                                Logs.Write("加拿大28Trap更新结果异常:" + result);
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// 根据北京快乐8结果,计算28结果
        /// </summary>
        /// <returns></returns>
        public static string AddLottery()
        {
            lock (lkbj)
            {
                //是否有投注或封盘记录
                bool listtoady = Lottery.ExistsBJ28(" and a.status in (0,1) and convert(varchar(10),a.opentime,120)='" + DateTime.Now.ToString("yyyy-MM-dd") + "'");
                if (!listtoady)
                {
                    return("");
                }
                string    root     = ConfigurationManager.AppSettings["lk28"];
                string    url      = root + "?token=7904a63f2fc9c2d2&code=bjkl8&rows=5&format=json&date=" + DateTime.Now.ToString("yyyy-MM-dd");
                string    bjjson   = HttpUtils.HttpGet(url, "");
                MD_28Json bj28json = JsonConvert.DeserializeObject <MD_28Json>(bjjson);
                if (bj28json.data.Count > 0)
                {
                    LK28Item item = bj28json.data[0];
                    //10 北京28  11 加拿大28

                    //更新开奖信息
                    item.opencode = item.opencode.Substring(0, item.opencode.Length - 3);
                    MD_Lottery lottery = new MD_Lottery
                    {
                        Type     = 10,
                        Expect   = item.expect,
                        Opencode = item.opencode,
                        Opentime = DateTime.Parse(item.opentime),
                        Status   = 2
                    };
                    //获取的开奖记录 是否是当前正在开奖的记录
                    bool listltty = Lottery.ExistsBJ28(" and a.expect='" + item.expect + "' and a.status<>2");
                    if (listltty)
                    {
                        GetBJResult(lottery, item);
                        string result = OWZX.Data.Lottery.UpdateLottery(lottery);
                        if (result.EndsWith("成功"))
                        {
                            return(lottery.Expect);
                        }
                        else
                        {
                            Logs.Write("北京28更新结果异常:" + result);
                        }
                        return("");
                    }
                }
            }
            return("");
        }
Example #7
0
 public void Execute()
 {
     //执行获取北京快乐8 开奖结果并计算出北京28开奖
     lock (lkclose)
     {
         try
         {
             Lottery.UpdateLotteryStatus();
         }
         catch (Exception ex)
         {
             LogClass.Log.WriteLogs("", "", "", "执行修改竞猜状态异常:" + ex.Message, root + @"\service\", false);
         }
     }
 }
Example #8
0
        public void Execute()
        {
            //执行获取北京快乐8 开奖结果并计算出北京28开奖
            lock (lkbjlk)
            {
                try
                {
                    TimeSpan startTime = DateTime.Parse(start).TimeOfDay;
                    TimeSpan endTime   = DateTime.Parse(end).TimeOfDay;
                    TimeSpan tmNow     = DateTime.Now.TimeOfDay;

                    if (tmNow >= startTime && tmNow <= endTime)
                    {
                        Lottery.InitLottery();
                    }
                }
                catch (Exception ex)
                {
                    LogClass.Log.WriteLogs("", "", "", "执行北京28异常:" + ex.Message, root + @"\service\bj28\", false);
                }
            }
        }
Example #9
0
        static string root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Logs";//服务运行路径

        /*
         * 彩票逻辑:投注3:30s 封盘 30s ,到时(每期规定的开奖时间)增加新的投注记录,开奖
         */
        public void Execute()
        {
            //执行获取加拿大卑斯快乐8 开奖结果并计算出加拿大28开奖
            lock (lkcanadalk)
            {
                try
                {
                    TimeSpan startTime = DateTime.Parse(start).TimeOfDay;
                    TimeSpan endTime   = DateTime.Parse(end).TimeOfDay;
                    TimeSpan tmNow     = DateTime.Now.TimeOfDay;

                    if (tmNow < startTime || tmNow > endTime)
                    {
                        Lottery.InitCanadaLottery();
                    }
                }
                catch (Exception ex)
                {
                    LogClass.Log.WriteLogs("", "", "", "执行加拿大28异常:" + ex.Message, root + @"\service\can28\", false);
                }
            }
        }