Exemple #1
0
    // 获得当期奖池结余
    private long NextPrize(int resultCID)
    {
        long nowprize = new BCW.BQC.BLL.BQCList().nowprize(resultCID);
        //获取已经派出奖金
        long _Price         = new BCW.BQC.BLL.BQCPay().AllWinCentbyCID(resultCID);
        long sysprizeshouxu = Convert.ToInt64(nowprize * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
        long Prices         = nowprize - _Price - sysprizeshouxu;//当期结余=当期奖池-当期系统收取-当期派奖

        return(Prices);
    }
Exemple #2
0
    //机器人兑奖
    public void RobotCase()
    {
        string RoBot     = ub.GetSub("RoBotID", xmlPath);
        string RoBotCost = ub.GetSub("ReBotCost", xmlPath);

        string[] RoBotID = RoBot.Split('#');
        int      meid    = 0;

        for (int i = 0; i < RoBotID.Length; i++)
        {
            meid = Convert.ToInt32(RoBotID[i]);
            DataSet model2 = new BCW.BQC.BLL.BQCPay().GetList("id", "usID=" + meid + " and IsSpier=1 and WinCent > 0 and State!=2 ");
            if (model2 != null && model2.Tables[0].Rows.Count > 0)
            {
                for (int i2 = 0; i2 < model2.Tables[0].Rows.Count; i2++)
                {
                    int pid = 0;
                    try
                    {
                        pid = Convert.ToInt32(model2.Tables[0].Rows[0][i2]);
                    }
                    catch { }
                    if (new BCW.BQC.BLL.BQCPay().ExistsReBot(pid, meid))
                    {
                        if (new BCW.BQC.DAL.BQCPay().getState(pid) != 2)
                        {
                            //new BCW.SFC.BLL.SfPay().RoBotByID(pid);
                            //操作币
                            BCW.BQC.Model.BQCPay model = new BCW.BQC.BLL.BQCPay().GetBQCPay(pid);
                            int  number   = new BCW.BQC.BLL.BQCPay().GetCID(pid);
                            long winMoney = Convert.ToInt64(model.WinCent);
                            new BCW.BLL.User().UpdateiGold(meid, winMoney, "" + ub.GetSub("BQCName", xmlPath) + "兑奖-期号-" + number + "-标识ID" + pid + "(" + model.IsPrize + "等奖)");
                            new BCW.BQC.BLL.BQCPay().UpdateState(pid);
                            builder.Append("" + ub.GetSub("BQCName", xmlPath) + "机器人" + meid + "自动兑奖!ok1<br />");
                        }
                    }
                }
            }
        }
    }
Exemple #3
0
    // 获得奖池币
    private long AllPrize(int resultCID)
    {
        //获取当前期数投注总额
        long AllPrice = new BCW.BQC.BLL.BQCPay().AllPrice(resultCID);
        //获取已经派出奖金
        long _Price = new BCW.BQC.BLL.BQCPay().AllWinCentbyCID(resultCID);
        //获取当前期数系统投注总额
        long Sysprize = new BCW.BQC.DAL.BQCList().getsysprize(resultCID);
        //获取当期系统投注状态
        int Sysprizestatue = new BCW.BQC.DAL.BQCList().getsysprizestatue(resultCID);
        //获取上一期滚存下来的奖池
        int lastcid = 0;

        if (new BCW.BQC.BLL.BQCList().Exists(resultCID - 1))
        {
            lastcid = (resultCID - 1);
        }
        else
        {
            lastcid = LastOpenCID();
        }
        long Nextprize = new BCW.BQC.DAL.BQCList().getnextprize(lastcid);

        //获取当前期数系统回收总额
        long SysWin = new BCW.BQC.BLL.BQCJackpot().SysWin(resultCID);
        //奖池总额
        long Prices = 0;

        if (Sysprizestatue == 3 || Sysprizestatue == 1)
        {
            Prices = (AllPrice + Nextprize + Sysprize);
        }
        else
        {
            Prices = (AllPrice + Nextprize);
        }
        return(Prices);
    }
Exemple #4
0
    //开奖页面
    public void CasePage()
    {
        #region 更新中奖

        #region 开奖结果
        //获取最新开奖结果
        DataSet qi = new BCW.BQC.BLL.BQCList().GetList("CID,Result", " Result!='" + null + "' Order by CID Desc ");
        int     CID = 0; string Result = string.Empty;
        CID    = Convert.ToInt32(qi.Tables[0].Rows[0][0]);  //最新开奖的期号
        Result = Convert.ToString(qi.Tables[0].Rows[0][1]); //最新开奖结果
        #endregion

        #region 判断中奖
        string[] resultnum = Result.Split(',');
        //遍历表BQCPay,更新中奖
        DataSet dspay = new BCW.BQC.BLL.BQCPay().GetList("CID,usID,vote,payCents,change,id", "CID=" + CID + " and State=0");
        if (dspay != null && dspay.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dspay.Tables[0].Rows.Count; i++)
            {
                //对比数据:对比两数组相同数据出现的次数
                int count = 0;
                //中奖标记,中奖注数
                int num1 = 0;
                int num2 = 0;

                int    pid      = int.Parse(dspay.Tables[0].Rows[i]["id"].ToString());
                int    UsID     = int.Parse(dspay.Tables[0].Rows[i]["UsID"].ToString());
                string Vote     = dspay.Tables[0].Rows[i]["Vote"].ToString();
                long   PayCents = Int64.Parse(dspay.Tables[0].Rows[i]["PayCents"].ToString());
                int    change   = int.Parse(dspay.Tables[0].Rows[i]["change"].ToString());
                bool   IsWin    = false;

                string[] buyvote = Vote.Split(',');                                         //数据库存储的投注记录格式:(3-3/3-1),(3-3/1-3),(3-3),(3-3),(3-3),(3-3)
                string[] vote1   = buyvote[0].Replace("(", "").Replace(")", "").Split('/'); //第一场比赛投注结果:胜胜3-3和胜平3-1
                string[] vote2   = buyvote[1].Replace("(", "").Replace(")", "").Split('/');
                string[] vote3   = buyvote[2].Replace("(", "").Replace(")", "").Split('/');
                string[] vote4   = buyvote[3].Replace("(", "").Replace(")", "").Split('/');
                string[] vote5   = buyvote[4].Replace("(", "").Replace(")", "").Split('/');
                string[] vote6   = buyvote[5].Replace("(", "").Replace(")", "").Split('/');

                List <string[]> list1 = new List <string[]>();
                list1.Add(vote1);
                list1.Add(vote2);
                list1.Add(vote3);
                list1.Add(vote4);
                list1.Add(vote5);
                list1.Add(vote6);
                string[] totalResult;
                //找到投注数据
                totalResult = bianli(list1);

                for (int iresult = 0; iresult < totalResult.Length; iresult++)
                {
                    string[] result = totalResult[iresult].Split(',');
                    for (int j = 0; j < result.Length; j++)
                    {
                        //遍历开奖数据是否相同,相同则count+1
                        if (result[j].Equals(resultnum[j]))
                        {
                            count++;
                        }
                        if (resultnum[j].Contains("*"))
                        {
                            count++;
                        }
                    }
                    //如果count出现的次数等于5,证明是二等奖
                    if (count == 5)
                    {
                        num2++;
                        IsWin = true;
                    }
                    //如果count出现的次数等于6,证明是一等奖
                    if (count == 6)
                    {
                        num1++;
                        IsWin = true;
                    }
                    count = 0;
                }

                if (IsWin == true)
                {
                    if (num2 > 0)
                    {
                        BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set ISPrize=2 ,ISPrize2=1, Prize2Num=" + num2 + " Where id=" + pid + "");//ISPrize2=1代表中二等奖,Prize2Num代表中二等奖的注数
                    }
                    if (num1 > 0)
                    {
                        BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set ISPrize=1 Where id=" + pid + "");//一等奖仅有一注
                    }
                }
            }
        }
        #endregion

        #region 奖池更新 (回收)
        if (Result != null)
        {
            if (new BCW.BQC.BLL.BQCList().getState(CID) == 0)
            {
                //判断奖池,小于200万就投入,大于不投入
                if (AllPrize(CID) < Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")))
                {
                    if (new BCW.BQC.BLL.BQCList().getsysstate(CID) == 0)
                    {
                        long all = AllPrize(CID) + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml"));
                        //更新奖池
                        new BCW.BQC.BLL.BQCList().updateNowprize(all, CID);
                        new BCW.BQC.BLL.BQCList().UpdateSysstaprize(CID, 3, Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")));

                        //把记录加到奖池表
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 8;//8表示系统首期有投入
                        mo.WinPrize = 0;
                        mo.Prize    = Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml"));
                        mo.other    = "系统首期(" + CID + "期)投入" + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")) + "|结余" + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")) + ub.Get("SiteBz");
                        mo.allmoney = all;
                        mo.AddTime  = DateTime.Now.AddMilliseconds(-10);
                        mo.CID      = CID;
                        new BCW.BQC.BLL.BQCJackpot().Add(mo);
                    }
                    else
                    {
                        //更新奖池
                        new BCW.BQC.BLL.BQCList().updateNowprize(AllPrize(CID), CID);
                    }
                }
                else if (AllPrize(CID) > Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")) && AllPrize(CID) < Convert.ToInt64(ub.GetSub("BQCMax", "/Controls/BQC.xml")))
                {
                    //更新奖池
                    new BCW.BQC.BLL.BQCList().updateNowprize(AllPrize(CID), CID);
                }
                //判断大于400万,有投入回收,无投入不回收
                //if (AllPrize(model.CID) > Convert.ToInt64(ub.GetSub("BQCMax", "/Controls/BQC.xml")))
                else
                {
                    //如果之前期数有投入为回收就回收,无则不做操作
                    if (new BCW.BQC.BLL.BQCList().Existsysprize(CID))
                    {
                        //未开奖当前投注期号
                        DataSet ds   = new BCW.BQC.BLL.BQCList().GetList("TOP 1 CID", "State=1 and sysprizestatue=1 order by CID ASC");
                        int     CIDh = 0;
                        CIDh = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                        new BCW.BQC.BLL.BQCList().UpdateSysstaprize(CID, 2, Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml")));//当期回收
                        long all = AllPrize(CID) - Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml"));
                        //更新奖池
                        new BCW.BQC.BLL.BQCList().updateNowprize(all, CID);

                        //把记录加到奖池表
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 7;//7表示系统有回收
                        mo.WinPrize = Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml"));
                        mo.Prize    = 0;
                        mo.other    = "系统回收" + Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml"));
                        mo.allmoney = all;
                        mo.AddTime  = DateTime.Now.AddMilliseconds(-500);
                        mo.CID      = CID;
                        new BCW.BQC.BLL.BQCJackpot().Add(mo);

                        if (CID != CIDh)
                        {
                            new BCW.BQC.BLL.BQCList().UpdateSysprizestatue(CIDh, 3);//表示被回收
                        }
                    }
                    else
                    {
                        //更新奖池
                        new BCW.BQC.BLL.BQCList().updateNowprize(AllPrize(CID), CID);
                    }
                }
            }
        }
        #endregion

        #region 奖池手续更新
        long Allmoney = new BCW.BQC.BLL.BQCList().nowprize(CID);
        //判断该期数有无中奖
        if (!new BCW.BQC.BLL.BQCPay().Exists(CID, 0))//无中奖
        {
            #region 无中奖奖池更新

            if (!new BCW.BQC.BLL.BQCList().ExistsSysprize(CID)) //如果不存在系统投注
            {
                if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID)) //开奖当前还没有数据
                {
                    BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                    mo.usID     = 0;
                    mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);//系统收回%10
                    mo.Prize    = 0;
                    long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                    long b = Convert.ToInt64(Allmoney) - a;
                    mo.other    = "系统收取手续" + a;
                    mo.allmoney = b;
                    mo.AddTime  = DateTime.Now;
                    mo.CID      = CID;
                    new BCW.BQC.BLL.BQCJackpot().Add(mo);
                }
            }
            else//如果存在系统投注
            {
                if (Allmoney > Convert.ToInt64(ub.GetSub("BQCMax", "/Controls/BQC.xml")))//最大奖池数
                {
                    if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID))
                    {
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 2;//表示回收投入的金额
                        mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.Prize    = 0;
                        long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01) + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml"));
                        long b = Convert.ToInt64(Allmoney) - Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.other    = "系统收取手续" + Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.allmoney = b;
                        mo.AddTime  = DateTime.Now;
                        mo.CID      = CID;

                        new BCW.BQC.BLL.BQCJackpot().Add(mo);
                    }
                }
                else//奖池与最小奖池数
                {
                    if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID))
                    {
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 2;
                        mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);//系统收回%10
                        mo.Prize    = 0;
                        long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        long b = Convert.ToInt64(Allmoney) - a;
                        mo.other    = "系统收取手续" + a;
                        mo.allmoney = b;
                        mo.AddTime  = DateTime.Now;
                        mo.CID      = CID;
                        new BCW.BQC.BLL.BQCJackpot().Add(mo);
                    }

                    //更新系统投注状态为3,表示小于最小额数不需要回收
                    // new BCW.BQC.BLL.BQCList().UpdateSysprizestatue(CID, 3);
                }
            }
            #endregion
        }
        else
        {
            #region 中奖奖池更新
            if (!new BCW.BQC.BLL.BQCList().ExistsSysprize(CID)) //如果不存在系统投注
            {
                if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID)) //开奖当前还没有数据
                {
                    BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                    mo.usID     = 2;
                    mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);//系统收回%10
                    mo.Prize    = 0;
                    long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                    long b = Convert.ToInt64(Allmoney) - a;
                    mo.other    = "系统收取手续" + a;
                    mo.allmoney = b;
                    mo.AddTime  = DateTime.Now;
                    mo.CID      = CID;
                    new BCW.BQC.BLL.BQCJackpot().Add(mo);
                }
            }
            else//如果存在系统投注
            {
                if (Allmoney > Convert.ToInt64(ub.GetSub("BQCMax", "/Controls/BQC.xml")))//最大奖池数
                {
                    if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID))
                    {
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 2;//表示回收投入的金额
                        mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.Prize    = 0;
                        long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01) + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml"));
                        long b = Convert.ToInt64(Allmoney) - Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.other    = "系统收取手续" + Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        mo.allmoney = b;
                        mo.AddTime  = DateTime.Now;
                        mo.CID      = CID;

                        new BCW.BQC.BLL.BQCJackpot().Add(mo);
                    }
                }
                else//奖池与最小奖池数
                {
                    if (!new BCW.BQC.BLL.BQCJackpot().Exists3(CID))
                    {
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = 2;
                        mo.WinPrize = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);//系统收回%10
                        mo.Prize    = 0;
                        long a = Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01);
                        long b = Convert.ToInt64(Allmoney) - a;
                        mo.other    = "系统收取手续" + a;
                        mo.allmoney = b;
                        mo.AddTime  = DateTime.Now;
                        mo.CID      = CID;
                        new BCW.BQC.BLL.BQCJackpot().Add(mo);
                    }

                    //更新系统投注状态为3,表示小于最小额数不需要回收
                    // new BCW.BQC.BLL.BQCList().UpdateSysprizestatue(CID, 3);
                }
            }
            #endregion
        }
        #endregion

        #region 派奖
        if (new BCW.BQC.DAL.BQCList().getState(CID) == 0)
        {
            DataSet pay = new BCW.BQC.BLL.BQCPay().GetList("usID,ISPrize,VoteNum,id", "CID=" + CID + " and State=0");
            if (dspay != null && dspay.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < pay.Tables[0].Rows.Count; i++)
                {
                    int pid           = int.Parse(pay.Tables[0].Rows[i]["id"].ToString());
                    int ISPrize       = int.Parse(pay.Tables[0].Rows[i]["ISPrize"].ToString());
                    int UsID          = int.Parse(pay.Tables[0].Rows[i]["usID"].ToString());
                    int VoteNum       = int.Parse(pay.Tables[0].Rows[i]["VoteNum"].ToString());
                    int overridebyid1 = new BCW.BQC.BLL.BQCPay().VoteNum1(pid, CID);
                    int overridebyid2 = new BCW.BQC.BLL.BQCPay().VoteNum2(pid, CID);
                    //得到当前奖池
                    long All = new BCW.BQC.BLL.BQCList().nowprize(CID);
                    long Now = NextPrize(CID);
                    if (VoteNum == 1)//单式派奖
                    {
                        //一等奖
                        if (new BCW.BQC.BLL.BQCPay().Exists1(pid, 1))
                        {
                            //注数
                            long zhu = new BCW.BQC.BLL.BQCPay().countPrize(CID, 1);
                            //费率
                            double lv   = Convert.ToDouble(ub.GetSub("BQCOne", "/Controls/BQC.xml")) * 0.01;
                            double allr = Math.Round(Convert.ToDouble(All * lv / Convert.ToDouble(zhu)), 2);
                            long   all  = Convert.ToInt64(allr * overridebyid1);

                            //添加奖池数据
                            BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                            mo.usID     = UsID;
                            mo.WinPrize = all;
                            mo.Prize    = 0;
                            mo.other    = "中一等奖" + Convert.ToString(all);
                            mo.allmoney = (Now - all);
                            mo.AddTime  = DateTime.Now;
                            mo.CID      = CID;
                            new BCW.BQC.BLL.BQCJackpot().Add(mo);

                            //动态
                            string wText = "[url=/bbs/uinfo.aspx?uid=" + UsID + "]" + new BCW.BLL.User().GetUsName(UsID) + "[/url]在第" + CID + "期[url=/bbs/game/BQC.aspx]" + GameName + "[/url]中一等奖" + all + "" + ub.Get("SiteBz") + "";
                            new BCW.BLL.Action().Add(1017, pid, UsID, "", wText);

                            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set WinCent=(( select WinCent from tb_BQCPay where id=" + pid + ")+" + all + ") Where id=" + pid + "");
                            //发送内线
                            new BCW.BLL.Guest().Add(1, UsID, "", "恭喜您在第" + CID + "期" + "[URL=/bbs/game/BQC.aspx]" + GameName + "[/URL]" + "投注,中一等奖奖" + all + "" + ub.Get("SiteBz") + ",开奖为" + Result + "[URL=/bbs/game/BQC.aspx?act=case]马上兑奖[/URL]");
                        }
                        //二等奖
                        if (new BCW.BQC.BLL.BQCPay().Exists2(pid, 2))
                        {
                            //注数
                            int zhu = new BCW.BQC.BLL.BQCPay().countPrize2(CID);
                            //费率
                            double lv   = Convert.ToDouble(ub.GetSub("BQCTwo", "/Controls/BQC.xml")) * 0.01;
                            double allr = Math.Round(Convert.ToDouble(All * lv / Convert.ToDouble(zhu)), 2);
                            long   all  = Convert.ToInt64(allr * overridebyid2);
                            //添加奖池数据
                            BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                            mo.usID     = UsID;
                            mo.WinPrize = all;
                            mo.Prize    = 0;
                            mo.other    = "中二等奖" + Convert.ToString(all);
                            mo.allmoney = (Now - all);
                            mo.AddTime  = DateTime.Now;
                            mo.CID      = CID;
                            new BCW.BQC.BLL.BQCJackpot().Add(mo);
                            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set WinCent=(( select WinCent from tb_BQCPay where id=" + pid + ")+" + all + ") Where id=" + pid + "");

                            //动态
                            string wText = "[url=/bbs/uinfo.aspx?uid=" + UsID + "]" + new BCW.BLL.User().GetUsName(UsID) + "[/url]在第" + CID + "期[url=/bbs/game/BQC.aspx]" + GameName + "[/url]中二等奖" + all + "" + ub.Get("SiteBz") + "";
                            new BCW.BLL.Action().Add(1017, pid, UsID, "", wText);

                            //发送内线
                            new BCW.BLL.Guest().Add(1, UsID, "", "恭喜您在第" + CID + "期" + "[URL=/bbs/game/BQC.aspx]" + GameName + "[/URL]" + "投注,中二等奖奖" + all + "" + ub.Get("SiteBz") + ",开奖为" + Result + "[URL=/bbs/game/BQC.aspx?act=case]马上兑奖[/URL]");
                        }
                    }
                    else//复式派奖
                    {
                        //一等奖
                        if (new BCW.BQC.BLL.BQCPay().Exists1(pid, 1))
                        {
                            //注数
                            long zhu = new BCW.BQC.BLL.BQCPay().countPrize(CID, 1);
                            //费率
                            double lv   = Convert.ToDouble(ub.GetSub("BQCOne", "/Controls/BQC.xml")) * 0.01;
                            double allr = Math.Round(Convert.ToDouble(All * lv / Convert.ToDouble(zhu)), 2);
                            long   all  = Convert.ToInt64(allr * overridebyid1);

                            //添加奖池数据
                            BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                            mo.usID     = UsID;
                            mo.WinPrize = all;
                            mo.Prize    = 0;
                            mo.other    = "中一等奖" + Convert.ToString(all);
                            mo.allmoney = (Now - all);
                            mo.AddTime  = DateTime.Now;
                            mo.CID      = CID;
                            new BCW.BQC.BLL.BQCJackpot().Add(mo);

                            //动态
                            string wText = "[url=/bbs/uinfo.aspx?uid=" + UsID + "]" + new BCW.BLL.User().GetUsName(UsID) + "[/url]在第" + CID + "期[url=/bbs/game/BQC.aspx]" + GameName + "[/url]中一等奖" + all + "" + ub.Get("SiteBz") + "";
                            new BCW.BLL.Action().Add(1017, pid, UsID, "", wText);

                            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set WinCent=(( select WinCent from tb_BQCPay where id=" + pid + ")+" + all + ") Where id=" + pid + "");
                            //发送内线
                            new BCW.BLL.Guest().Add(1, UsID, "", "恭喜您在第" + CID + "期" + "[URL=/bbs/game/BQC.aspx]" + GameName + "[/URL]" + "投注,中一等奖奖" + all + "" + ub.Get("SiteBz") + ",开奖为" + Result + "[URL=/bbs/game/BQC.aspx?act=case]马上兑奖[/URL]");
                        }
                        //二等奖
                        if (new BCW.BQC.BLL.BQCPay().Exists2(pid, 2))
                        {
                            //注数
                            int zhu = new BCW.BQC.BLL.BQCPay().countPrize2(CID);
                            //费率
                            double lv   = Convert.ToDouble(ub.GetSub("BQCTwo", "/Controls/BQC.xml")) * 0.01;
                            double allr = Math.Round(Convert.ToDouble(All * lv / Convert.ToDouble(zhu)), 2);
                            long   all  = Convert.ToInt64(allr * overridebyid2);
                            //添加奖池数据
                            BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                            mo.usID     = UsID;
                            mo.WinPrize = all;
                            mo.Prize    = 0;
                            mo.other    = "中二等奖" + Convert.ToString(all);
                            mo.allmoney = (new BCW.BQC.BLL.BQCJackpot().Getallmoney(CID) - all);
                            mo.AddTime  = DateTime.Now;
                            mo.CID      = CID;
                            new BCW.BQC.BLL.BQCJackpot().Add(mo);
                            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set WinCent=(( select WinCent from tb_BQCPay where id=" + pid + ")+" + all + ") Where id=" + pid + "");

                            //动态
                            string wText = "[url=/bbs/uinfo.aspx?uid=" + UsID + "]" + new BCW.BLL.User().GetUsName(UsID) + "[/url]在第" + CID + "期[url=/bbs/game/BQC.aspx]" + GameName + "[/url]中二等奖" + all + "" + ub.Get("SiteBz") + "";
                            new BCW.BLL.Action().Add(1017, pid, UsID, "", wText);

                            //发送内线
                            new BCW.BLL.Guest().Add(1, UsID, "", "恭喜您在第" + CID + "期" + "[URL=/bbs/game/BQC.aspx]" + GameName + "[/URL]" + "投注,中二等奖奖" + all + "" + ub.Get("SiteBz") + ",开奖为" + Result + "[URL=/bbs/game/BQC.aspx?act=case]马上兑奖[/URL]");
                        }
                    }
                }
            }
        }
        #endregion

        #region 更新奖池结余,更新系统收取手续
        if (new BCW.BQC.DAL.BQCList().getState(CID) == 0)
        {
            //更新当期系统结余奖池
            new BCW.BQC.DAL.BQCList().UpdateNextprize(CID, NextPrize(CID));
            //更新当期系统收取手续
            new BCW.BQC.DAL.BQCList().Updatesysdayprize(CID, Convert.ToInt64(Allmoney * Convert.ToInt64(ub.GetSub("BQCsys", "/Controls/BQC.xml")) * 0.01));
        }
        #endregion

        #region 奖池滚存
        int newcid = 0;
        if (new BCW.BQC.DAL.BQCList().ExistsCID(CID + 1))
        {
            newcid = (CID + 1);
        }
        else
        {
            newcid = FirstNewCID();
        }
        if (!new BCW.BQC.DAL.BQCJackpot().Existsgun(CID))
        {
            //把奖池滚存记录下来
            BCW.BQC.Model.BQCJackpot mos = new BCW.BQC.Model.BQCJackpot();
            mos.usID     = 5;
            mos.WinPrize = 0;
            mos.Prize    = 0;
            mos.other    = "第" + CID + "期滚存" + NextPrize(CID) + ub.Get("SiteBz") + "到" + newcid + "期|结余0" + ub.Get("SiteBz");
            mos.allmoney = 0;
            mos.AddTime  = DateTime.Now;
            mos.CID      = CID;
            new BCW.BQC.BLL.BQCJackpot().Add(mos);
        }
        if (!new BCW.BQC.DAL.BQCJackpot().Existsgun1(newcid))
        {
            //把奖池滚存记录下来
            BCW.BQC.Model.BQCJackpot mos = new BCW.BQC.Model.BQCJackpot();
            mos.usID     = 6;
            mos.WinPrize = 0;
            mos.Prize    = 0;
            mos.other    = "得到第" + CID + "期滚存" + NextPrize(CID) + ub.Get("SiteBz") + "|结余" + NextPrize(CID) + "" + ub.Get("SiteBz");
            mos.allmoney = 0;
            mos.AddTime  = Convert.ToDateTime("2000-10-10 10:10:10");
            mos.CID      = (newcid);
            new BCW.BQC.BLL.BQCJackpot().Add(mos);
        }
        #endregion

        #region 遍历奖池表 (BQCJackpot),更新预售期的奖池
        //遍历表BQCJackpot,更新预售期的奖池
        if (new BCW.BQC.DAL.BQCList().ExistsCID((newcid)))
        {
            DataSet nextPP = new BCW.BQC.BLL.BQCJackpot().GetList("id,usID,Prize,WinPrize,other,allmoney,AddTime,CID", "CID=" + (newcid) + " ");

            if (nextPP != null && nextPP.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < nextPP.Tables[0].Rows.Count; i++)
                {
                    int      pid      = int.Parse(nextPP.Tables[0].Rows[i]["id"].ToString());
                    int      UsID     = int.Parse(nextPP.Tables[0].Rows[i]["usID"].ToString());
                    long     Prize    = Int64.Parse(nextPP.Tables[0].Rows[i]["Prize"].ToString());
                    long     WinPrize = Int64.Parse(nextPP.Tables[0].Rows[i]["WinPrize"].ToString());
                    string   other    = nextPP.Tables[0].Rows[i]["other"].ToString();
                    long     allmoney = Int64.Parse(nextPP.Tables[0].Rows[i]["allmoney"].ToString());
                    DateTime AddTime  = DateTime.Parse(nextPP.Tables[0].Rows[i]["AddTime"].ToString());
                    int      CID1     = int.Parse(nextPP.Tables[0].Rows[i]["CID"].ToString());

                    long PP = 0;
                    if (new BCW.BQC.BLL.BQCList().getsysstate((newcid)) == 1)
                    {
                        PP = (allmoney + NextPrize(CID) + Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")));
                    }
                    else
                    {
                        PP = (allmoney + NextPrize(CID));
                    }
                    //更新奖池
                    if (other.Contains("预售"))
                    {
                        BCW.Data.SqlHelper.ExecuteSql("update tb_BQCJackpot set allmoney='" + PP + "' Where id='" + pid + "' ");
                        BCW.Data.SqlHelper.ExecuteSql("update tb_BQCJackpot set other=replace(other,'预售','') where id='" + pid + "' ");
                    }
                }
            }
            else
            {
            }
        }
        #endregion

        #region 系统投入
        if (new BCW.BQC.DAL.BQCList().getState(CID) == 0)
        {
            if (new BCW.BQC.BLL.BQCList().Exists((newcid)))
            {
                long paycent = new BCW.BQC.BLL.BQCList().GetPrice("sum(PayCent)", " CID =" + (newcid) + " ");//消费
                if ((NextPrize(CID) + paycent) < Convert.ToInt64(ub.GetSub("BQCMin", "/Controls/BQC.xml")))
                {
                    new BCW.BQC.BLL.BQCList().UpdateSysstaprize((newcid), 1, Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml")));

                    //把记录加到奖池表
                    BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                    mo.usID     = 1;//1表示系统有投入
                    mo.WinPrize = 0;
                    mo.Prize    = Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml"));
                    mo.other    = "系统投入" + Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml"));
                    mo.allmoney = (Convert.ToInt64(ub.GetSub("BQCSend", "/Controls/BQC.xml")) + NextPrize(CID));
                    mo.AddTime  = DateTime.Now;
                    mo.CID      = (newcid);
                    new BCW.BQC.BLL.BQCJackpot().Add(mo);
                }
            }
        }
        #endregion

        #region 完成返彩后正式更新该期为结束
        if (new BCW.BQC.BLL.BQCList().getState(CID) == 0)
        {
            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCList set State=1 Where CID=" + CID + "");
            BCW.Data.SqlHelper.ExecuteSql("update tb_BQCPay set State=1 Where CID=" + CID + "");
        }
        #endregion

        #endregion
    }
Exemple #5
0
    //机器人ROBOT
    public void Robot()
    {
        string xml      = ub.GetSub("IsBot", xmlPath);
        int    buycount = int.Parse(ub.GetSub("RoBotCount", xmlPath));//次数

        if (xml == "1")
        {
            string   RoBot   = ub.GetSub("RoBotID", xmlPath);
            string[] RoBotID = RoBot.Split('#');
            int      n       = RoBot.Split('#').Length;

            Random rr = new Random();
            int    aa = 0;
            aa = rr.Next(0, n);
            string ss   = RoBotID[aa];
            int    usID = Convert.ToInt32(ss);
            ChanageOnline(Convert.ToInt32(RoBotID[aa]));

            string mename = new BCW.BLL.User().GetUsName(usID);//用户姓名

            //未开奖当前投注期号
            DataSet  ds1     = new BCW.BQC.BLL.BQCList().GetList("TOP 1 CID", "State=0 order by CID ASC");
            int      CID     = 0;
            DateTime AddTime = DateTime.Now;

            try
            {
                CID = int.Parse(ds1.Tables[0].Rows[0][0].ToString());
            }
            catch
            {
            }
            BCW.BQC.Model.BQCList mod = new BCW.BQC.BLL.BQCList().GetBQCList1(CID);
            if (mod.Sale_StartTime < DateTime.Now && mod.EndTime > DateTime.Now)
            {
                //计数出该机器人投注的次数是否大于xml限定次数
                int countrebot = new BCW.BQC.BLL.BQCPay().GetBQCRobotCount("usID=" + usID + " and IsSpier=1 and CID=" + CID + "");
                if (countrebot <= buycount)
                {
                    long     bei  = 0;
                    string[] ppp  = ub.GetSub("RoBotCost", xmlPath).Split('#');
                    Random   ranm = new Random();
                    int      k    = ranm.Next(0, (ppp.Length));
                    bei = Convert.ToInt32(ppp[k]);


                    long   Price1  = Utils.ParseInt64(ub.GetSub("BQCmallPay", xmlPath)) * bei;
                    string SFprice = ub.GetSub("BQCprice", xmlPath);

                    //是否刷屏
                    long   small   = Convert.ToInt64(ub.GetSub("BQCmallPay", xmlPath));
                    long   big     = Convert.ToInt64(ub.GetSub("BQCBigPay", xmlPath));
                    string appName = "BQC";
                    int    Expir   = Utils.ParseInt(ub.GetSub("BQCExpir", xmlPath));//5
                    //BCW.User.Users.IsFresh(appName, Expir);


                    string GameName = ub.GetSub("BQCName", xmlPath);
                    //个人每期限投
                    long xPrices = 1;
                    xPrices = Utils.ParseInt64(ub.GetSub("BQCCprice", xmlPath));

                    Random ran      = new Random();
                    int[]  a        = new int[] { 0, 1, 3 };
                    string votenum1 = string.Empty;
                    string votenum  = string.Empty;
                    string s        = string.Empty;
                    for (int j = 0; j < 12; j++)
                    {
                        s = a[ran.Next(0, 3)].ToString();
                        if (j == 0)
                        {
                            votenum1 += "(" + s + "-";
                        }
                        else if (j == 11)
                        {
                            votenum1 += s + ")";
                        }
                        else
                        {
                            if (j % 2 == 0)
                            {
                                votenum1 += s + "-";
                            }
                            else
                            {
                                votenum1 += s + "),(";
                            }
                        }
                    }
                    votenum = votenum1;//得到随机投注

                    //支付安全提示
                    string[] p_pageArr = { "CID", "Price", "bei", "Price1", "votenum", "ptype", "act", "info" };
                    long     gold      = new BCW.BLL.User().GetGold(usID);

                    if (gold < Price1)
                    {
                        builder.Append("您(" + usID + ")的" + ub.Get("SiteBz") + "不足购买此下注(6场半)");
                    }
                    if (gold < 0)
                    {
                        builder.Append("您的" + ub.Get("SiteBz") + "不足(6场半)");
                    }
                    if (xPrices > 0)
                    {
                        int     oPrices = 0;
                        DataSet ds      = null;
                        try
                        {
                            ds = new BCW.SFC.BLL.SfPay().GetList("PayCents", "UsID=" + usID + " and CID=" + CID + "");
                        }
                        catch
                        {
                            Utils.Error("!", "");
                        }
                        DataTable dt = ds.Tables[0];
                        foreach (DataRow dr in dt.Rows)
                        {
                            int drs = int.Parse(dr[0].ToString());
                            oPrices = oPrices + drs;
                        }
                        if (oPrices + Price1 > xPrices)
                        {
                            if (oPrices >= xPrices)
                            {
                                Utils.Error("您(" + usID + ")本期下注已达上限,请等待下期...", "");
                            }
                            else
                            {
                                Utils.Error("您(" + usID + ")本期最多还可以下注" + (xPrices - oPrices) + "" + ub.Get("SiteBz") + "", "");
                            }
                        }
                    }
                    if (gold > Price1 && gold > 0 && CID != 0)
                    {
                        BCW.BQC.Model.BQCPay modelpay = new BCW.BQC.Model.BQCPay();
                        modelpay.usID     = usID;
                        modelpay.Vote     = votenum;              //投注情况
                        modelpay.VoteNum  = 1;                    //投注总数
                        modelpay.IsPrize  = 0;                    //中奖情况
                        modelpay.IsSpier  = 1;                    //机器人
                        modelpay.AddTime  = DateTime.Now;
                        modelpay.CID      = CID;                  //期号
                        modelpay.OverRide = Convert.ToInt32(bei); //投注倍率
                        modelpay.PayCents = Price1;               //投注总额
                        modelpay.State    = 0;                    //兑奖
                        modelpay.PayCent  = Convert.ToInt32(ub.GetSub("BQCmallPay", xmlPath));
                        modelpay.change   = 0;
                        new BCW.BQC.BLL.BQCPay().Add(modelpay);
                        //添加奖池数据
                        BCW.BQC.Model.BQCJackpot mo = new BCW.BQC.Model.BQCJackpot();
                        mo.usID     = usID;
                        mo.WinPrize = 0;
                        mo.Prize    = Price1;
                        mo.other    = "下注" + Convert.ToString(Price1);
                        mo.allmoney = AllPrize(CID);
                        mo.AddTime  = DateTime.Now;
                        mo.CID      = CID;
                        new BCW.BQC.BLL.BQCJackpot().Add(mo);

                        int maxid = new BCW.BQC.BLL.BQCPay().GetMaxId(usID);
                        new BCW.BLL.User().UpdateiGold(usID, mename, -Price1, "" + ub.GetSub("BQCName", xmlPath) + "第" + CID + "期投注" + votenum + "标识id" + (maxid - 1));//半全场----更新排行榜与扣钱
                        //更新每期下注额度
                        new BCW.BQC.BLL.BQCList().UpdatePayCent(new BCW.BQC.BLL.BQCPay().PayCents(CID), CID);
                        //更新每期下注数
                        new BCW.BQC.BLL.BQCList().UpdatePayCount(new BCW.BQC.BLL.BQCPay().VoteNum(CID), CID);
                        string wText = "[url=/bbs/uinfo.aspx?uid=" + usID + "]" + mename + "[/url]在[url=/bbs/game/BQC.aspx]" + GameName + "[/url]下注**" + "" + ub.Get("SiteBz") + "";//+ Price1
                        new BCW.BLL.Action().Add(1017, 1, usID, "", wText);
                        Response.Write("<br /><span style='color:red;font-size:20px'>6场半机器人(" + usID + ")正在执行下注任务!</span>");
                    }
                }
                else
                {
                    Response.Write("<br /><span style='color:red;font-size:20px'>6场半机器人(" + usID + ")已经完成下注任务!当期下注次数已达上限!</span>");
                }
            }
            else
            {
                Response.Write("<br /><span style='color:red;font-size:20px'>6场半机器人未开始工作,等待当期结束,下一期开始投注" + CID + "</span>");
            }
        }
    }