예제 #1
0
        /// <summary>
        /// 新增一星走势数据
        /// </summary>
        /// <param name="type"></param>
        /// <param name="tendencys"></param>
        public static void SaveTendency1(Tendency1Enum type, List <LotteryModel> ltData)
        {
            int index = (int)type;

            LotteryModel minData = ltData[ltData.Count - 1];

            //上一期趋势
            TendencyModel preTendency1 = null;

            //本次上一次开奖趋势,除非最后一期
            int prePperiod = int.Parse(minData.Sno) - 1;

            if (prePperiod > 0)
            {
                preTendency1 = MysqlHelper.QueryTendency1(type, minData.Ymd, prePperiod.ToString().PadLeft(4, '0'));
            }

            AnalyzeTendency      At         = new AnalyzeTendency();
            List <TendencyModel> ltTendency = new List <TendencyModel>();

            for (int i = ltData.Count - 1; i >= 0; i--)
            {
                LotteryModel  lm = ltData[i];
                TendencyModel tm = new TendencyModel();
                tm.Ymd     = lm.Ymd;
                tm.Lottery = lm.Lottery;
                tm.Sno     = lm.Sno;

                tm.Big   = At.BigNum(lm, preTendency1, index);        //大大
                tm.Small = At.SmallNum(lm, preTendency1, index);      //小小
                tm.Odd   = At.OddPairNum(lm, preTendency1, index, 1); //奇奇
                tm.Pair  = At.OddPairNum(lm, preTendency1, index, 0); //偶偶

                tm.Prime     = At.Prime(lm, preTendency1, index);     //质数
                tm.Composite = At.Composite(lm, preTendency1, index); //合数

                tm.Big_1   = At.Big_1(lm, preTendency1, index);       //大
                tm.Mid_1   = At.Mid_1(lm, preTendency1, index);       //中
                tm.Small_1 = At.Small_1(lm, preTendency1, index);     //小

                tm.No_0 = At.RoadNum012(lm, preTendency1, index, 0);  //0路
                tm.No_1 = At.RoadNum012(lm, preTendency1, index, 1);  //1路
                tm.No_2 = At.RoadNum012(lm, preTendency1, index, 2);  //2路

                tm.Dtime = lm.Dtime;

                ltTendency.Add(tm);

                prePperiod = int.Parse(lm.Sno);
                if (prePperiod == 1380)
                {
                    preTendency1 = null;
                }
                else
                {
                    preTendency1 = tm;
                }
            }

            MysqlHelper.SaveTendency1(type, ltTendency);
        }