Пример #1
0
        /// <summary>
        /// 获取奖金
        /// </summary>
        /// <param name="rcount"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        protected virtual decimal GetBaseAmtLstItem(int bonusCount, BasicModel.LotteryBasic.BetDetail item, ref decimal stepAmt)
        {
            PlayTypeRadio outPlayTypeRadio = null;
            var           res = this.GetBaseAmtLst(item, ref outPlayTypeRadio);

            if (res == null)
            {
                return(0);
            }
            var it = res.Where(c => c.BonusCount == bonusCount).FirstOrDefault();

            if (it == null)
            {
                return(0);
            }

            decimal baseAmt = 0;

            if (item.BonusLevel == 1700)
            {
                baseAmt = item.PrizeType == 1 ? it.BonusBasic17 : GetbackNumMonery(it.MaxBonus17, outPlayTypeRadio.MaxRebate1700, it.StepAmt1700, item.BackNum);// GetbackNumMonery(it.MaxBonus17,item.PalyRadioCode,item.BackNum); ;
                stepAmt = it.StepAmt1700;
            }
            else
            {
                baseAmt = item.PrizeType == 1 ? it.BonusBasic : GetbackNumMonery(it.MaxBonus, outPlayTypeRadio.MaxRebate, it.StepAmt, item.BackNum); //it.MaxBonus;
                stepAmt = it.StepAmt;
            }

            return(baseAmt);
        }
        /// <summary>
        /// 根据玩法单选获取返点信息
        /// </summary>
        /// <param name="playType">奖金类型 0:1800 1:1700</param>
        /// <param name="userRebate">用户返点</param>
        /// <param name="playRadio">玩法对象</param>
        /// <returns></returns>
        public static string GetRebateInfo(int playType, double userRebate, PlayTypeRadio playRadio)
        {
            decimal max;
            double  userBackNum;
            decimal bonusBasic;

            if (playType == 0)                                                                                                        //1800 玩法
            {
                max         = TotalAmt(Convert.ToDecimal(playRadio.BonusBasic), playRadio.StepAmt, playRadio.MaxRebate - userRebate); //舍弃返点最高奖金
                userBackNum = playRadio.MaxRebate - userRebate;                                                                       //用户返点
                bonusBasic  = playRadio.BonusBasic;
            }
            else
            {
                max = TotalAmt(playRadio.BonusBasic17, playRadio.StepAmt1700, playRadio.MaxRebate1700 - userRebate);
                //1700
                userBackNum = playRadio.MaxRebate1700 - userRebate;//用户返点
                bonusBasic  = playRadio.BonusBasic17;
            }
            userBackNum = Math.Round(userBackNum, 1);//保留一位小数
            //if (userBackNum <= 0)
            //    return "{}";
            //else
            return("{ levs: '" + Utils.DecimalConvert(max) + "', defaultprize:" + Utils.DecimalConvert(bonusBasic) + ", userdiffpoint:" + userBackNum + "}");
        }
Пример #3
0
        /// <summary>
        /// 计算中奖金额,stepAmt * 10 * item.BackNum *10得意思是:除以0.1相当于*10
        /// </summary>
        /// <param name="item">投注详情</param>
        /// <param name="baseAmt">基础奖金</param>
        /// <param name="stepAmt">每增加0.1的返点 增加多少奖金</param>
        /// <param name="count">中多少注</param>
        /// <returns></returns>
        protected decimal TotalWinMoney(BetList item, int count, PlayTypeRadio fs, SysUser user, bool isAppendMiu = true)
        {
            decimal[] models = { 1M, 0.1M, 0.01M, 0.001M };
            //计算
            decimal stepAmt = 0;
            decimal baseAmt = 0;

            //返点/舍弃返点
            if (user.PlayType == 0)//1800
            {
                baseAmt = fs.MaxBonus - Convert.ToDecimal(user.Rebate) * 10 * fs.StepAmt;
                if (item.PrizeType == 1)
                {
                    baseAmt = fs.BonusBasic;
                }
            }
            else
            {
                baseAmt = fs.MaxBonus17 - Convert.ToDecimal(user.Rebate) * 10 * fs.StepAmt1700;
                if (item.PrizeType == 1)
                {
                    baseAmt = fs.BonusBasic17;
                }
            }

            decimal total = 0;

            if (isAppendMiu)
            {
                total = count * (baseAmt - stepAmt) * models[item.Model] * item.Multiple;
            }
            else
            {
                total = (baseAmt - stepAmt) * models[item.Model];
            }
            return(Math.Round(total, 4));
        }
        private static void DefaultMeth(double userBackNum, int playType, StringBuilder builder, StringBuilder lotteryBuilder, PlayTypeRadio radio, RadioHelper helper, bool isk3 = false)
        {
            builder.Append("{");
            int noBigIndex   = 5;
            int maxcodecount = 0;


            builder.Append("methoddesc: '" + helper.methoddesc + "',");
            builder.Append("methodhelp: '" + helper.methodhelp + "',");
            builder.Append("methodexample: '" + helper.methodexample + "',");
            builder.Append("selectarea: {type: '" + helper.type + "',layout: [" + string.Join(",", helper.Layouts) + "],noBigIndex:" + noBigIndex + ",isButton: " + helper.isButton);
            if (!string.IsNullOrEmpty(helper.selPosition))
            {
                builder.Append(",'selPosition' : '" + helper.selPosition + "'");
            }
            builder.Append("},");
            builder.Append("show_str: '" + helper.show_str + "',code_sp: '" + helper.code_sp + "',methodid: " + (isk3?helper.Key[0]:radio.RadioCode) + ",name: '" + radio.PlayTypeRadioName + "',");//如果为k3的话,直接使用code
            if (!string.IsNullOrEmpty(helper.defaultposition))
            {
                builder.Append("'defaultposition' : '" + helper.defaultposition + "',");
            }
            builder.Append("prize: { 1: '" + Utils.DecimalConvert(playType == 0 ? radio.BonusBasic : radio.BonusBasic17) + "' },");
            if (!radio.IsFixed && !isk3)//非块3
            {
                builder.Append("nfdprize:" + GetRebateInfo(playType, userBackNum, radio) + ",");
            }
            else
            {
                builder.Append("nfdprize:{},");
            }
            builder.Append("modes: [{ modeid: 1, name: '元', rate: 1 }, { modeid: 2, name: '角', rate: 0.1 }, { modeid: 3, name: '分', rate: 0.01 },{ modeid: 4, name: '厘', rate: 0.001 }],");

            string desc = string.IsNullOrEmpty(helper.Desc) ? radio.PlayTypeRadioName : helper.Desc;

            builder.Append("desc: '" + desc + "', maxcodecount:" + maxcodecount + "");
            builder.Append("}");
        }
Пример #5
0
        /// <summary>
        /// 根据 投注信息获取奖金集合
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected virtual List <PlayTypeRadiosBonus> GetBaseAmtLst(BasicModel.LotteryBasic.BetDetail item, ref PlayTypeRadio radio)
        {
            var source        = BaseDataCatch.GetPalyTypeRadio();
            var palyTypeRadio = source.Where(c => c.RadioCode == item.PalyRadioCode).FirstOrDefault();

            if (null == palyTypeRadio)
            {
                return(null);
            }
            radio = palyTypeRadio;
            return(BaseDataCatch.GetPlayTypeRadiosBonus().Where(c => c.RadioCode == palyTypeRadio.RadioCode).ToList());
        }
Пример #6
0
 private decimal GetbackNumMonery1700(decimal BonusBasic, PlayTypeRadio radio, decimal backNum)
 {
     return(GetbackNumMonery(BonusBasic, radio.MaxRebate1700, radio.StepAmt1700, backNum));
 }
        /// <summary>
        /// 计算中奖金额,stepAmt * 10 * item.BackNum *10得意思是:除以0.1相当于*10
        /// </summary>
        /// <param name="item">投注详情</param>
        /// <param name="baseAmt">基础奖金</param>
        /// <param name="stepAmt">每增加0.1的返点 增加多少奖金</param>
        /// <param name="count">中多少注</param>
        /// <returns></returns>
        private static decimal TotalWinMoney(Ytg.BasicModel.LotteryBasic.DTO.BetDetailDTO item, int count, PlayTypeRadio fs, BettUserDto cookUserInfo)
        {
            decimal[] models = { 1M, 0.1M, 0.01M, 0.001M };
            //计算
            decimal stepAmt = 0;
            decimal baseAmt = 0;

            //返点/舍弃返点
            if (cookUserInfo.PlayType == 0)//1800
            {
                baseAmt = fs.MaxBonus - Convert.ToDecimal(cookUserInfo.Rebate) * 10 * fs.StepAmt;
                if (item.PrizeType == 1)
                {
                    baseAmt = fs.BonusBasic;
                }
            }
            else
            {
                baseAmt = fs.MaxBonus17 - Convert.ToDecimal(cookUserInfo.Rebate) * 10 * fs.StepAmt1700;
                if (item.PrizeType == 1)
                {
                    baseAmt = fs.BonusBasic17;
                }
            }

            var total = count * (baseAmt - stepAmt) * models[item.Model] * (int)item.Multiple;

            return(Math.Round(total, 4));
        }
        /// <summary>
        /// 可能中奖的金额
        /// </summary>
        public static decimal GetAutoWinMonery(Ytg.BasicModel.LotteryBasic.DTO.BetDetailDTO item, BettUserDto cookUserInfo, PlayTypeRadio fs)
        {
            //可能中的奖金
            if (null == fs)
            {
                return(99999999);
            }

            decimal sumWinMonery = 0;

            if (!fs.HasMoreBonus)//普通奖金
            {
                //返点/舍弃返点
                sumWinMonery += TotalWinMoney(item, 1, fs, cookUserInfo);
            }
            else
            {//拥有更多中奖方式的
                List <string> ct = new List <string>();
                if (item.BetContent.IndexOf("-") >= 0)
                {
                    var cts = item.BetContent.Split('-');
                    foreach (var c in cts)
                    {
                        if (string.IsNullOrEmpty(c))
                        {
                            continue;
                        }
                        ct.Add(Ytg.Comm.SpecialConvert.ConvertTo(Convert.ToInt32("-" + c)));
                    }
                }
                var wins = PlayTypeRadiosBonusServiceCatch.GetAll().Where(c => c.RadioCode == fs.RadioCode).ToList();
                //是否为特殊玩法
                for (var i = 0; i < wins.Count; i++)
                {
                    var itemw = wins[i];
                    if (ct.Count > 0 && !ct.Contains(itemw.BonusTitle))
                    {
                        continue;
                    }
                    decimal[] models = { 1M, 0.1M, 0.01M, 0.001M };
                    sumWinMonery += (Ytg.Comm.Global.DecimalConvert(cookUserInfo.PlayType == 0 ? itemw.BonusBasic : itemw.BonusBasic17) * models[item.Model] * (int)item.Multiple);
                }
            }

            return(sumWinMonery);
        }