Example #1
0
        /// <summary>
        /// 已开奖
        /// </summary>
        /// <param name="type"></param>
        /// <param name="title"></param>
        /// <param name="number"></param>
        /// <param name="opentime"></param>
        /// <param name="numberAll"></param>
        /// <returns></returns>
        public static bool ExistLottery(int type, string title, string number, string opentime, string numberAll)
        {
            string cacheKey = string.Format(Const.CACHE_KEY_LOTTERY_HISTORY, type);
            IList <LotteryDataModel> history = _dal.GetLotteryHistory(type);

            //数据已存在
            if ((from it in history where it.Title == title select it).Count() > 0)
            {
                Log.ErrorFormat("彩票已开奖, 彩种: {0}, 期号: {1}", type, title);
                return(true);
            }

            //更新缓存
            if (history.Count > 0)
            {
                history.RemoveAt(history.Count - 1); //移除最后一条
            }

            history.Insert(0, new LotteryDataModel()
            {
                Type      = type,
                Title     = title,
                Number    = number,
                NumberAll = numberAll,
                Total     = LotterySum.SumNumber(number),
                Dx        = 0,
                Ds        = 0,
                Flag      = 0,
                Flag2     = 0,
                IsFill    = true,
                OpenTime  = Convert.ToDateTime(opentime)
            });

            RTCache.Insert(cacheKey, history);
            return(false);
        }