Exemple #1
0
        //public static List<LotteryPlay> SlpList()
        //{
        //    if (slpList.Count == 0)
        //    {
        //        slpList = LpList().Where(n => n.PrizeClass != null).ToList();
        //    }
        //    return slpList;
        //}
        /// <summary>
        /// 判断当期奖金是否超额
        /// </summary>
        /// <param name="BList"></param>
        /// <param name="openNo"></param>
        /// <returns>true为超额</returns>
        public static bool isOutBetMoney(List <BetInfo> BList, List <int> openCode, bool isLimit, decimal betTotalMoney, decimal abTotalMoney, decimal Prizepool, out decimal backTotalMoney)
        {
            var flag = false;

            backTotalMoney = 0;                                     //总返奖金额
            var f3       = openCode.Take(3).ToList();               //前三号字符串
            var f2       = openCode.Take(2).ToList();               //前二号字符串
            var dan      = openCode.Where(n => n % 2 != 0).Count(); //单号个数
            var zhongwei = openCode.OrderBy(n => n).ToList()[2];    //中位值

            foreach (var item in BList)
            {
                decimal backMoney = 0;
                item.WinUnit = isWin(item.BetPlayTypeCode, item.BetNum, openCode, f3, f2, dan, zhongwei, out backMoney);//中奖次数
                if (item.WinUnit > 0)
                {
                    if (!item.IsGetBackPercent)//若不要返点
                    {
                        item.BackMoney = AgentCalculateTool.GetAgentBackMoney_11x5(backMoney, item.GetBackPercent);
                    }
                    else
                    {
                        item.BackMoney = backMoney;
                    }
                    item.BackMoney  = item.BackMoney * (item.BetMoney / item.BetUnit / 2);//(item.BetMoney /item.BetUnit/2)=投注单位(元角分厘)*倍数=中奖金额倍数
                    backTotalMoney += item.BackMoney;
                    //if (SlpList().Count(n => n.BetPlayTypeCode == item.BetPlayTypeCode) == 0)//非特殊型中奖
                    //{

                    //    item.BackMoney = item.WinUnit * item.MaxBackMoney;
                    //    backTotalMoney += item.BackMoney;
                    //}
                    //else
                    //{
                    //    item.BackMoney = SlpList().FirstOrDefault(n => n.SpecialValue == item.WinUnit).PayBack * (item.BetMoney / item.BetUnit / 2);
                    //    backTotalMoney += item.BackMoney;//特殊型按默认奖金算
                    //    item.WinUnit = 1;
                    //}
                    //flag = (backTotalMoney / new decimal(0.995)) > betTotalMoney;//中奖金额是否小于等于总投注的91.5%
                    //flag = backTotalMoney > (Prizepool<=0?(new decimal(0.916) * betTotalMoney):(new decimal(0.8) * betTotalMoney + Prizepool));//中奖金额是否小于等于总投注
                    if (isLimit)
                    {
                        flag = backTotalMoney > (betTotalMoney - abTotalMoney) + (Prizepool < new decimal(0.1) * betTotalMoney ? 0 : Prizepool - new decimal(0.1) * betTotalMoney);
                        if (flag)
                        {
                            break;
                        }
                    }
                }
            }
            return(flag);
        }
        /// <summary>
        /// 判断当期奖金是否超额
        /// </summary>
        public static bool isOutBetMoney(List <BetInfo> BetList, List <int> openCode, bool isLimit, decimal betTotalMoney, decimal abTotalMoney, decimal Prizepool, out decimal backTotalMoney)
        {
            var         flag     = false;
            List <int>  h4       = openCode.ToList(); h4.RemoveAt(0);                 //四星
            List <int>  h3       = openCode.ToList(); h3.RemoveRange(0, 2);           //后三
            List <int>  z3       = openCode.ToList(); z3.RemoveAt(4); z3.RemoveAt(0); //中三
            List <int>  q3       = openCode.ToList(); q3.RemoveRange(3, 2);           //前三
            List <int>  h2       = openCode.ToList(); h2.RemoveRange(0, 3);           //后二
            List <int>  q2       = openCode.ToList(); q2.RemoveRange(2, 3);           //前二
            int         dan      = openCode.Count(n => n % 2 == 1);                   //单号个数
            int         da       = openCode.Count(n => n > 5);                        //大号个数
            List <ZXLB> zxlbList = null;
            int         bjh      = LotteryPlayArithmetic.pd(openCode, out zxlbList);  //百家号开奖号类别(120,60,30.....)

            backTotalMoney = 0;                                                       //总返奖金额
            foreach (var item in BetList)
            {
                List <int> rxdswz = null; decimal BackMoney = 0;
                if (!string.IsNullOrEmpty(item.ChoicePosition))
                {
                    rxdswz = item.ChoicePosition.Split(',').Select(n => Convert.ToInt32(n)).ToList();                                                     //存在选号位(任选类型)
                }
                item.WinUnit = isWin(item.BetPlayTypeCode, item.BetNum, rxdswz, openCode, h4, h3, z3, q3, h2, q2, dan, da, bjh, zxlbList, out BackMoney); //中奖次数
                if (item.WinUnit > 0)
                {
                    if (!item.IsGetBackPercent)//若不要返点
                    {
                        item.BackMoney = AgentCalculateTool.GetAgentBackMoney_SSC(BackMoney, item.GetBackPercent);
                    }
                    item.BackMoney  = item.BackMoney * (item.BetMoney / item.BetUnit / 2); //(item.BetMoney /item.BetUnit/2)=投注单位(元角分厘)*倍数=中奖金额倍数
                    backTotalMoney += item.BackMoney;
                    if (isLimit)                                                           //是否按限制开奖
                    {
                        flag = backTotalMoney > (betTotalMoney - abTotalMoney) + (Prizepool < new decimal(0.1) * betTotalMoney ? 0 : Prizepool - new decimal(0.1) * betTotalMoney);
                        if (flag)
                        {
                            break;
                        }
                    }
                }
            }
            return(flag);
        }
        /// <summary>
        /// 获取返点奖金
        /// </summary>
        /// <param name="BetPlayTypeCode"></param>
        /// <param name="percent"></param>
        /// <returns></returns>
        public List <string> GetAgentBackMoneyByCode(int BetPlayTypeCode, decimal percent, string lotteryType)
        {
            List <string> list = new List <string>();

            switch (lotteryType)
            {
            case "ssc":
                list.Add(AgentCalculateTool.GetAgentBackMoney_SSC(BetPlayTypeCode, percent) + "-0%");
                list.Add(LotteryInfo_SSC.LpList()[BetPlayTypeCode - 1].PayBack + "-" + percent + "%");
                break;

            case "11x5":
                list.Add(AgentCalculateTool.GetAgentBackMoney_11x5(BetPlayTypeCode, percent) + "-0%");
                list.Add(LotteryOpenTool_11x5.LpList()[BetPlayTypeCode - 1].PayBack + "-" + percent + "%");
                break;

            case "dpc":
                list.Add(AgentCalculateTool.GetAgentBackMoney_3D(BetPlayTypeCode, percent) + "-0%");
                list.Add(LotteryOpenTool_3D.LpList()[BetPlayTypeCode - 1].PayBack + "-" + percent + "%");
                break;
            }
            return(list);
        }