Пример #1
0
        public Tuple <int[], GetLotteryInfoResq> GetLottery(GetLotteryInfoReq para)
        {
            ActivityInfoProcessing activityInfoProcessing = new ActivityInfoProcessing();
            int todayCount = activityInfoProcessing.GetTodayLotteryCount(para);

            if (todayCount == 0)
            {
                int rondom = LotteryProbability.GetRondom();
                activityInfoProcessing.InserLotteryInfo(para, rondom);
                return(new Tuple <int[], GetLotteryInfoResq>(new int[] { rondom, rondom, rondom }, GetLotteryInfo(para)));
            }
            else if (todayCount == 1)
            {
                int index0 = LotteryProbability.GetRondom();
                int index1 = LotteryProbability.GetRondom();
                int index2 = LotteryProbability.GetRondom();

                if (index0 == index1 && index1 == index2)
                {
                    activityInfoProcessing.InserLotteryInfo(para, index0);
                }
                else
                {
                    activityInfoProcessing.InserLotteryInfo(para, -1);
                }

                return(new Tuple <int[], GetLotteryInfoResq>(new int[] { index0, index1, index2 }, GetLotteryInfo(para)));
            }
            else  //两次机会都用完了
            {
                return(new Tuple <int[], GetLotteryInfoResq>(new int[] { }, null));
            }
        }
Пример #2
0
        public int GetRondomLottery()
        {
            ActivityInfoProcessing    activityInfoProcessing = new ActivityInfoProcessing();
            List <LotteryChanceModel> lotteryChanceModels    = activityInfoProcessing.GetLotteryChance();
            int result = LotteryProbability.Get(lotteryChanceModels.Select(m => m.F_LotteryChance));

            return(lotteryChanceModels[result].F_LotteryIndex);
        }