Exemplo n.º 1
0
        /// <summary>
        ///获取开奖结果集合
        /// </summary>
        /// <returns></returns>
        public List <JJOG1K3Result> GetLotteryOpenList()
        {
            List <JJOG1K3Result> list = new List <JJOG1K3Result>();

            //获取最新的抓取列表
            string     html  = GetLotteryOpenResult();
            JsonResult jsonR = Util.DeserializeObject <JsonResult>(html);
            string     code  = jsonR.code;

            if (code == "success")
            {
                #region 成功

                string        D_Date      = "";
                Data          data        = jsonR.data;
                Backdata      backData    = data.backData;
                Lotteryopen[] lotteryopen = backData.lotteryOpen;
                D_Date = backData.time;
                foreach (Lotteryopen item in lotteryopen)
                {
                    JJOG1K3Result entity = new JJOG1K3Result();
                    entity.openTime    = item.openTime;
                    entity.issueNo     = item.issueNo;
                    entity.daxiao      = item.daxiao == "da" ? "大" : "小";
                    entity.danshuang   = item.danshuang == "dan" ? "单" : "双";
                    entity.Count       = item.count;
                    entity.lotteryOpen = item.lotteryOpen;
                    entity.D_Date      = Util.ConvertToDateTime(D_Date);
                    List <string> vList   = Util.Split(",", item.lotteryOpen);
                    string        Value_1 = vList[0];
                    string        Value_2 = vList[1];
                    string        Value_3 = vList[2];

                    list.Add(entity);
                }
                #endregion
            }
            else
            {
                if (jsonR.code == "nologin")
                {
                    RepeatLogin();
                }
                return(GetLotteryOpenList());
            }

            return(list);
        }
Exemplo n.º 2
0
        public void Pick()
        {
            string html = jjKit.GetLotteryOpenResult();

            try
            {
                JsonResult jsonR = Util.DeserializeObject <JsonResult>(html);
                string     code  = jsonR.code;
                if (code == "success")
                {
                    string        D_Date      = "";
                    Data          data        = jsonR.data;
                    Backdata      backData    = data.backData;
                    Lotteryopen[] lotteryopen = backData.lotteryOpen;
                    D_Date = backData.time;
                    foreach (Lotteryopen item in lotteryopen)
                    {
                        string        openTime  = item.openTime;
                        string        issueNo   = item.issueNo;
                        string        daxiao    = item.daxiao == "da" ? "大" : "小";
                        string        danshuang = item.danshuang == "dan" ? "单" : "双";
                        int           Count     = item.count;
                        List <string> vList     = Util.Split(",", item.lotteryOpen);
                        string        Value_1   = vList[0];
                        string        Value_2   = vList[1];
                        string        Value_3   = vList[2];

                        #region 存档
                        object obj     = DBHelper.GetSingle(connString, "JJ_一分快三", "count(0)", "  issueNo ={0}", issueNo);
                        int    isExist = Util.ConvertToInt32(obj);
                        if (isExist == 0)
                        {
                            SqlParameter[] pramsAdd =
                            {
                                new SqlParameter()
                                {
                                    ParameterName = "@D_Date", Value = D_Date
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@openTime", Value = openTime
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@issueNo", Value = issueNo
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@daxiao", Value = daxiao
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@danshuang", Value = danshuang
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@Count", Value = Count
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@Value_1", Value = Value_1
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@Value_2", Value = Value_2
                                },
                                new SqlParameter()
                                {
                                    ParameterName = "@Value_3", Value = Value_3
                                },
                            };
                            DBHelper.Add(connString, "JJ_一分快三", pramsAdd);
                            msg("期数=" + issueNo + ",值=" + item.lotteryOpen);
                        }
                        #endregion
                    }
                }
                else
                {
                    if (jsonR.code == "nologin")
                    {
                        msg("重新登陆");
                        Login();
                    }
                    else
                    {
                        msg(jsonR.msg.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Ku.Common.LogsRecord.write("Error", html);
                throw ex;
            }
        }