コード例 #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);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 根据加拿大卑斯快乐8结果,计算28结果
        /// </summary>
        /// <returns></returns>
        public static string AddCanadaLottery()
        {
            lock (lkcan)
            {
                bool listtoady = Lottery.ExistsCanada28(" and a.status in (0,1)");
                if (!listtoady)
                {
                    return("");
                }
                string    root     = ConfigurationManager.AppSettings["lk28"];
                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];
                    //10 北京28  11 加拿大28

                    //更新开奖信息
                    MD_Lottery lottery = new MD_Lottery
                    {
                        Type     = 11,
                        Expect   = item.expect,
                        Opencode = item.opencode,
                        Opentime = DateTime.Parse(item.opentime),
                        Status   = 2
                    };
                    //获取的开奖记录 是否是当前正在开奖的记录
                    bool listltty = Lottery.ExistsCanada28(" and a.expect='" + item.expect + "' and a.status<>2");
                    if (listltty)
                    {
                        GetCanaResult(lottery, item);

                        string result = OWZX.Data.Lottery.UpdateLottery(lottery);
                        if (result.EndsWith("成功"))
                        {
                            return(lottery.Expect);
                        }
                        else
                        {
                            Logs.Write("加拿大28更新结果异常:" + result);
                        }
                        return("");
                    }
                }
            }
            return("");
        }