示例#1
0
    //机器人购买下注操作
    private void PlayLuck(int LuckId)
    {
        //得到随机的UsID
        int meid = GetUsID();

        if (meid == 0)
        {
            Response.Write("随机机器人ID出错.error1<br/>");
            Response.End();
        }
        if (!new BCW.BLL.User().ExistsID(meid))
        {
            Response.Write("随机机器人ID不存在.error1<br/>");
            Response.End();
        }
        #region  隐藏财产
        string   ForumSet   = new BCW.BLL.User().GetForumSet(meid);
        string[] fs         = ForumSet.Split(",".ToCharArray());
        string   sforumsets = string.Empty;
        for (int i = 0; i < fs.Length; i++)
        {
            string[] sfs = fs[i].ToString().Split("|".ToCharArray());
            if (i == 24)
            {
                if (string.IsNullOrEmpty(sforumsets))
                {
                    sforumsets += sfs[0] + "|" + 1;
                }
                else
                {
                    sforumsets += "," + sfs[0] + "|" + 1;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(sforumsets))
                {
                    sforumsets += sfs[0] + "|" + sfs[1];
                }
                else
                {
                    sforumsets += "," + sfs[0] + "|" + sfs[1];
                }
            }
        }
        new BCW.BLL.User().UpdateForumSet(meid, sforumsets);
        #endregion
        if (IsOpen() == false)
        {
            //Response.Write("" + GameName + "_机器人已休息close1!");
            //Response.End();
        }
        ChanageOnline(meid);

        //得到下注的类型  待写
        int num1 = Get28Type();
        //int num1 = 13;

        int  bzType  = 0;            // new Random().Next(0, 2);
        long paycent = GetPayCent(); //得到下注金额
                                     // Utils.Error("paycent:"+ paycent, "");
        string mename = new BCW.BLL.User().GetUsName(meid);

        long   gold   = 0;
        string bzText = string.Empty;
        if (bzType == 0)
        {
            gold   = new BCW.BLL.User().GetGold(meid);
            bzText = ub.Get("SiteBz");
        }
        else
        {
            gold   = new BCW.BLL.User().GetMoney(meid);
            bzText = ub.Get("SiteBz2");
        }
        #region  读XML
        long Luck28BigCents   = Utils.ParseInt(ub.GetSub("Luck28BigCents", xmlPath));//半数浮动设置下注额
        long Luck28SmallCents = Utils.ParseInt(ub.GetSub("Luck28SmallCents", xmlPath));

        long Luck28SingleCents = Utils.ParseInt(ub.GetSub("Luck28SingleCents", xmlPath));
        long Luck28DoubleCents = Utils.ParseInt(ub.GetSub("Luck28DoubleCents", xmlPath));

        long Luck28BigSingleCents   = Utils.ParseInt(ub.GetSub("Luck28BigSingleCents", xmlPath));
        long Luck28SmallSingleCents = Utils.ParseInt(ub.GetSub("Luck28SmallSingleCents", xmlPath));

        long Luck28BigDoubleCents   = Utils.ParseInt(ub.GetSub("Luck28BigDoubleCents", xmlPath));
        long Luck28SmallDoubleCents = Utils.ParseInt(ub.GetSub("Luck28SmallDoubleCents", xmlPath));

        long Luck28FirstCents  = Utils.ParseInt(ub.GetSub("Luck28FirstCents", xmlPath));//分段每个段设置下注额
        long Luck28SecendCents = Utils.ParseInt(ub.GetSub("Luck28SecendCents", xmlPath));

        long Luck28ThreeCents = Utils.ParseInt(ub.GetSub("Luck28ThreeCents", xmlPath));
        long Luck28AllCents   = Utils.ParseInt(ub.GetSub("Luck28AllCents", xmlPath));

        string FloatBig    = (ub.GetSub("FloatBig", xmlPath));//得到浮动赔率
        string FloatSmall  = (ub.GetSub("FloatSmall", xmlPath));
        string FloatSingle = (ub.GetSub("FloatSingle", xmlPath));
        string FloatDouble = (ub.GetSub("FloatDouble", xmlPath));

        string bigsingleodds   = ub.GetSub("Luck28BigSingle", xmlPath);
        string smallsingleodds = ub.GetSub("Luck28SmallSingle", xmlPath);
        string bigdoubleoddds  = ub.GetSub("Luck28BigDouble", xmlPath);
        string smalldoubleodds = ub.GetSub("Luck28SmallDouble", xmlPath);
        string firstodds       = ub.GetSub("Luck28First", xmlPath);
        string secendodds      = ub.GetSub("Luck28Secend", xmlPath);
        string threeodds       = ub.GetSub("Luck28Three", xmlPath);

        long Big   = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Big");
        long small = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Small");

        long single = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Single");
        long doubl  = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Double");

        long bigsingle   = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28BigSingle");
        long smallsingle = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28SmallSingle");

        long bigdouble   = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28BigDouble");
        long smalldouble = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28SmallDouble");

        long first  = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28First");
        long secend = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Secend");

        long three    = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28Three");
        long all      = new BCW.BLL.Game.Luckpay().GetSumBuyTypeCent(LuckId, "Luck28All");
        long MaxPool  = Utils.ParseInt(ub.GetSub("Luck28MaxPool", xmlPath));                 //每期下注总额
        long hadbuy   = new BCW.BLL.Game.Luckpay().GetPrice("BuyCents", "LuckId=" + LuckId); //得到某一期所有玩家的下注金额
        long paysmall = Convert.ToInt64(ub.GetSub("Luck28SmallPay", xmlPath));
        long paybig   = Convert.ToInt64(ub.GetSub("Luck28BigPay", xmlPath));
        #endregion
        //机器人每一期的最高购买次数
        int    buyCount   = Convert.ToInt32(ub.GetSub("Luck28RobotBuy", xmlPath));
        string BuyNum     = "";
        string EngText    = "";
        string Text       = "";
        string myend      = "";
        string odds       = "";
        string weishu     = string.Empty;
        int    flag       = 1; //是否可以下注
        long   allBuyCent = 0; //总的下注额

        #region 机械人下注
        //  else
        //{
        BCW.Model.Game.Lucklist luck = new BCW.BLL.Game.Lucklist().GetNextLucklist(); //得到最新一期
        long wanjia = 0;
        int  count  = new BCW.BLL.Game.Luckpay().GetRobotbuy(meid, luck.ID);          //得到机械人的下注次数

        if ((count < buyCount) && (buyCount != 0))                                    //可以下注
        {
            #region 机械人下注


            #region 大小单双
            if (num1 == 1)
            {
                BuyNum     = "14,15,16,17,18,19,20,21,22,23,24,25,26,27";
                EngText    = "Luck28Big";
                Text       = "押大";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > Luck28BigCents - Big + small)
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = FloatBig;
            }
            else if (num1 == 2)
            {
                BuyNum     = "0,1,2,3,4,5,6,7,8,9,10,11,12,13";
                Text       = "小";
                EngText    = "Luck28Small";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28SmallCents - small + Big))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = FloatSmall;
            }
            else if (num1 == 3)
            {
                BuyNum     = "1,3,5,7,9,11,13,15,17,19,21,23,25,27";
                Text       = "单";
                EngText    = "Luck28Single";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28SingleCents - single + doubl))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = FloatSingle;
            }
            else if (num1 == 4)
            {
                BuyNum     = "0,2,4,6,8,10,12,14,16,18,20,22,24,26";
                Text       = "双";
                EngText    = "Luck28Double";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28DoubleCents - doubl + single))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = FloatDouble;
            }
            else if (num1 == 5)
            {
                BuyNum     = "15,17,19,21,23,25,27";
                Text       = "大单";
                EngText    = "Luck28BigSingle";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28BigSingleCents - bigsingle + smallsingle))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = bigsingleodds.ToString();
            }
            else if (num1 == 6)
            {
                BuyNum     = "1,3,5,7,9,11,13";
                Text       = "小单";
                EngText    = "Luck28SmallSingle";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28SmallSingleCents - smallsingle + bigsingle))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = smallsingleodds.ToString();
            }
            else if (num1 == 7)
            {
                BuyNum     = "14,16,18,20,22,24,26";
                Text       = "大双";
                EngText    = "Luck28BigDouble";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28BigDoubleCents - bigdouble + smalldouble))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = bigdoubleoddds.ToString();
            }
            else if (num1 == 8)
            {
                BuyNum     = "0,2,4,6,8,10,12";
                Text       = "小双";
                EngText    = "Luck28SmallDouble";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28SmallDoubleCents - smalldouble + bigdouble))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = smalldoubleodds.ToString();
            }
            else if (num1 == 9)
            {
                BuyNum     = "0,1,2,3,4,5,6,7,8,9";
                Text       = "一段";
                EngText    = "Luck28First";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28FirstCents - first))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = firstodds.ToString();
            }
            else if (num1 == 10)
            {
                BuyNum     = "10,11,12,13,14,15,16,17,18";
                Text       = "二段";
                EngText    = "Luck28Secend";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28SecendCents - secend))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = secendodds.ToString();
            }
            else if (num1 == 11)
            {
                BuyNum     = "19,20,21,22,23,24,25,26,27";
                Text       = "三段";
                EngText    = "Luck28Three";
                wanjia     = paycent;
                allBuyCent = paycent;
                if ((wanjia) > (Luck28ThreeCents - three))
                {
                    flag = 0;
                }
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
                odds = threeodds.ToString();
            }
            #endregion
            else if (num1 == 12)
            {
                BuyNum  = Choose(27);
                Text    = "自选";
                EngText = "Luck28Choose";
                wanjia  = paycent;
                //  Response.Write("产生的自选号码是:" + BuyNum + "<>br/");
                string[] a = BuyNum.Split(',');
                allBuyCent = paycent * a.Length;
                for (int i = 0; i < a.Length; i++)
                {
                    string haoma  = a[i].ToString();                                                  //得到选的第几个号码
                    long   canbuy = Utils.ParseInt(ub.GetSub("Luck28Buy" + haoma, xmlPath));          //得到每个号码最大下注金额
                    long   hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCentbychoose(luck.ID, haoma); //得到某数字的已下的总下注金额
                    if (hasbuy + paycent > canbuy)                                                    //某数字的总下注金额 + 玩家单个数下注金额   >  该号码最大下注金额
                    {
                        flag = 0;
                    }
                    if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                    {
                        flag = 0;
                    }
                }
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
            }
            else if (num1 == 13)
            {
                BuyNum  = Choose(10);
                myend   = BuyNum;
                Text    = "尾号";
                EngText = "Luck28End";
                wanjia  = paycent;
                //  Response.Write("产生的尾号是:" + BuyNum + "<br/>");
                string[] a     = BuyNum.Split(',');
                string   getWS = "";
                for (int i = 0; i < a.Length; i++)
                {
                    #region 尾数判断
                    if (a[i] == "0")
                    {
                        getWS = "0,10,20";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last0Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS+"<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "1")
                    {
                        getWS = "1,11,21";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last1Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "2")
                    {
                        getWS = "2,12,22";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last2Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "3")
                    {
                        getWS = "3,13,23";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last3Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "4")
                    {
                        getWS = "4,14,24";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last4Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "5")
                    {
                        getWS = "5,15,25";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last5Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                //  Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "6")
                    {
                        getWS = "6,16,26";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last6Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "7")
                    {
                        getWS = "7,17,27";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last7Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                //  Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "8")
                    {
                        getWS = "8,18";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last8Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                // Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }
                    else if (a[i] == "9")
                    {
                        getWS = "9,19";
                        long canbuy = Utils.ParseInt(ub.GetSub("Luck28Last9Cents", xmlPath));   //得到号码最大下注金额
                        long hasbuy = new BCW.BLL.Game.Luckpay().GetSumBuyCent(luck.ID, getWS); //得到某数字的总下注金额
                                                                                                //Response.Write("尾数:" + getWS + "<br/>");
                        if (((hasbuy + (paycent))) > canbuy)                                    //某数字的总下注金额 + 玩家单个数下注金额   >  号码最大下注金额
                        {
                            flag = 0;
                        }
                        if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                        {
                            flag = 0;
                        }
                    }

                    if (string.IsNullOrEmpty(weishu))
                    {
                        weishu = weishu + getWS;
                    }
                    else
                    {
                        weishu = weishu + "," + getWS;
                    }
                    #endregion
                }
                BuyNum = weishu;
                //Response.Write("尾数是:" + weishu + "<br/>");
                //Response.Write("BuyNum:" + BuyNum + "<br/>");
                string[] Temp1 = myend.Split(',');
                //  Response.Write("尾数总数:" + Temp1.Length + "<br/>");
                allBuyCent = paycent * Temp1.Length;
                if ((allBuyCent + hadbuy) > MaxPool)//当前玩家下注+之前所有玩家下注 >  当期最大下注金额
                {
                    flag = 0;
                }
                //Response.Write("wanjia:" + wanjia + "<br/>");
                //Response.Write("Temp1.Length:" + Temp1.Length + "<br/>");
                //Response.Write("allBuyCent:" + allBuyCent + "<br/>");
                if (allBuyCent > paybig || allBuyCent < paysmall)//超过单注下注范围
                {
                    flag = 0;
                }
            }
            long myIDPay     = new BCW.BLL.Game.Luckpay().GetPrice("BuyCents", "LuckId=" + LuckId + " and UsID=" + meid); //得到这一期该玩家的总下注额
            long XMLEveryPay = Convert.ToInt64(ub.GetSub("Luck28EveryPay", xmlPath));                                     //限制每个ID每期下注的金额

            if (myIDPay + allBuyCent > XMLEveryPay)
            {
                flag = 0;
                Response.Write("每期每ID最多可下" + XMLEveryPay + ub.Get("SiteBz") + ",你已下" + myIDPay + ub.Get("SiteBz"));
                // Utils.Error("每期每ID最多可下" + XMLEveryPay + ub.Get("SiteBz") + ",你已下" + myIDPay + ub.Get("SiteBz"), "");
            }
            #endregion

            if (flag == 1)//可以下注并且不超过最大下注额
            {
                if (gold < allBuyCent || gold < 0)
                {
                    // Response.Write("<b>机器人" + meid + "币不够!请换一个机器人或者给该机器人充值 </b><br />");
                    //更新消费记录
                    BCW.Model.Goldlog modelx = new BCW.Model.Goldlog();
                    modelx.BbTag  = 3;
                    modelx.Types  = 0;
                    modelx.PUrl   = Utils.getPageUrl();//操作的文件名
                    modelx.UsId   = meid;
                    modelx.UsName = mename;

                    modelx.AcGold    = paycent;
                    modelx.AfterGold = gold + allBuyCent;//更新后的币数

                    modelx.AcText  = "系统机器人自动操作";
                    modelx.AddTime = DateTime.Now;
                    new BCW.BLL.Goldlog().Add(modelx);
                    BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+(" + allBuyCent + ") where id=" + meid + "");
                }
                //   Utils.Error("allBuyCent:"+ allBuyCent+ ",EngText:"+ EngText, "");
                Response.Write("paycent:" + paycent + "<br/>");
                Response.Write("BuyNum:" + BuyNum + "<br/>");
                Response.Write("allBuyCent:" + allBuyCent + "<br/>");
                Response.Write("EngText:" + EngText + "<br/>");
                Response.Write("flag:" + flag + "<br/>");
                //return;
                //  Response.Write("尾数:" + myend + "<br/>");
                count++;//机械人下注次数加一
                Response.Write(meid + "机械人可以加入数据库:" + count + "<br/>");
                BCW.Model.Game.Luckpay model = new BCW.Model.Game.Luckpay();
                model.LuckId   = LuckId;
                model.UsID     = meid;
                model.UsName   = mename;
                model.BuyCent  = paycent;
                model.BuyCents = allBuyCent;
                model.BuyNum   = BuyNum;
                model.BuyType  = EngText;
                model.State    = 0;
                model.IsRobot  = 1;//是机械人下注
                model.WinCent  = 0;
                model.AddTime  = DateTime.Now;
                if (odds != "")
                {
                    model.odds = odds;
                }
                else
                {
                    model.odds = "1";
                }
                // Response.Write("allBuyCent:" + allBuyCent + "<br/>");
                int id = new BCW.BLL.Game.Luckpay().Add(model);
                if (EngText == "Luck28Choose")
                {
                    //向102加钱
                    //  new BCW.BLL.User().UpdateiGold(102, new BCW.BLL.User().GetUsName(102), allBuyCent, "ID:" + meid + "二八第" + luck.Bjkl8Qihao + "期买" + Text + BuyNum + "共" + allBuyCent + "-标识" + id + "");
                    //扣币
                    new BCW.BLL.User().UpdateiGold(meid, new BCW.BLL.User().GetUsName(meid), -allBuyCent, "二八第" + luck.Bjkl8Qihao + "期押" + Text + BuyNum + "-标识" + id + "");
                }
                else if (Text == "Luck28End")
                {
                    new BCW.BLL.User().UpdateiGold(meid, new BCW.BLL.User().GetUsName(meid), -allBuyCent, "二八第" + luck.Bjkl8Qihao + "期押" + Text + "" + myend + "-标识" + id + "");
                }
                else
                {
                    new BCW.BLL.User().UpdateiGold(meid, new BCW.BLL.User().GetUsName(meid), -allBuyCent, "二八第" + luck.Bjkl8Qihao + "期押" + Text + ",赔率:" + model.odds + "-标识" + id + "");
                }
                string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/luck28.aspx]幸运28第" + luck.Bjkl8Qihao + "期[/url]下注**" + ub.Get("SiteBz") + "";//" + Convert.ToInt64(allBuyCent) + "
                new BCW.BLL.Action().Add(1020, id, 0, "", wText);
            }
            else
            {
                // Response.Write(meid + "机械人下注过大:"+allBuyCent+"<br/>" );
            }
        }
        else
        {
            Response.Write(meid + "机械人不能再下注啦:" + count);
        }
    }
示例#2
0
    private void OkPage()
    {
        string Name  = Utils.GetRequest("Name", "post", 2, @"^\d{1,10}$|^(?:13|14|15|18)\d{9}$", "请正确输入ID或者手机号");
        string Pwd   = Utils.GetRequest("Pwd", "post", 2, @"^[A-Za-z0-9]{6,20}$", "请正确输入您的密码");
        bool   IsMy  = bool.Parse(Utils.GetRequest("IsMy", "post", 1, @"^True|False$", "False"));
        int    State = int.Parse(Utils.GetRequest("State", "post", 1, @"^[0-1]$", "0"));

        int rowsAffected = 0;

        BCW.Model.User modellogin = new BCW.Model.User();
        modellogin.UsPwd = Utils.MD5Str(Pwd);
        if (Name.Length == 11)
        {
            modellogin.Mobile = Name;
            rowsAffected      = new BCW.BLL.User().GetRowByMobile(modellogin);
        }
        else
        {
            modellogin.ID = Convert.ToInt32(Name);
            rowsAffected  = new BCW.BLL.User().GetRowByID(modellogin);
        }

        if (rowsAffected > 0)
        {
            BCW.Model.User model = new BCW.Model.User();
            //if (Name.Length == 11)
            //{
            //    model = new BCW.BLL.User().GetKey(Name);
            //}
            //else
            //{
            //model = new BCW.BLL.User().GetKey(Convert.ToInt32(Name));
            //}

            model = new BCW.BLL.User().GetKey(rowsAffected);


            int    UsId     = model.ID;
            string UsKey    = model.UsKey;
            string UsPwd    = model.UsPwd;
            int    IsVerify = model.IsVerify;
            if (IsVerify == 2)
            {
                Utils.Error("您的ID还没有通过邮箱验证,如您没到验证邮件,<a href=\"" + Utils.getUrl("reg.aspx?act=reemail") + "\">请重试</a>", "");
            }
            string ac = Utils.GetRequest("ac", "all", 1, "", "");
            if (Utils.ToSChinese(ac) == "安全登录")
            {
                //取随机识别串
                UsKey = new Rand().RandNum(10);
                new BCW.BLL.User().UpdateUsKey(UsId, UsKey);
            }

            //加密用户密码
            string strPwd = Utils.MD5Str(UsPwd.Trim());
            //设置keys
            string keys = "";
            keys = BCW.User.Users.SetUserKeys(UsId, UsPwd, UsKey);
            string bUrl = string.Empty;
            if (Utils.getPage(1) != "")
            {
                bUrl = Utils.getUrl(Utils.removeUVe(Utils.getPage(1)));
            }
            else
            {
                bUrl = Utils.getUrl("/default.aspx");
            }
            //更新识别串
            string SID = ConfigHelper.GetConfigString("SID");
            bUrl = UrlOper.UpdateParam(bUrl, SID, keys);
            //写入Cookie
            if (IsMy == true)
            {
                HttpCookie cookie = new HttpCookie("LoginComment");
                cookie.Expires = DateTime.Now.AddDays(30);//30天
                cookie.Values.Add("userkeys", DESEncrypt.Encrypt(Utils.Mid(keys, 0, keys.Length - 4)));
                Response.Cookies.Add(cookie);
            }
            else
            {
                //清Cookie
                HttpCookie Cookie = new HttpCookie("LoginComment");
                Cookie.Expires = DateTime.Now.AddDays(-1);
                HttpContext.Current.Response.Cookies.Add(Cookie);
            }
            if (Request["IsMy"] == "pwd")
            {
                string   ForumSet   = new BCW.BLL.User().GetForumSet(UsId);
                string[] fs         = ForumSet.Split(",".ToCharArray());
                string   sforumsets = string.Empty;
                for (int i = 0; i < fs.Length; i++)
                {
                    string[] sfs = fs[i].ToString().Split("|".ToCharArray());

                    if (i == 25)
                    {
                        sforumsets += "," + sfs[0] + "|" + DateTime.Now;
                    }
                    else
                    {
                        sforumsets += "," + sfs[0] + "|" + sfs[1];
                    }
                }
                sforumsets = Utils.Mid(sforumsets, 1, sforumsets.Length);
                new BCW.BLL.User().UpdateForumSet(UsId, sforumsets);
            }
            //----------------------写入登录日志文件作永久保存
            try
            {
                string MyIP   = Utils.GetUsIP();
                string ipCity = string.Empty;
                if (!string.IsNullOrEmpty(MyIP))
                {
                    ipCity = new IPSearch().GetAddressWithIP(MyIP);
                    if (!string.IsNullOrEmpty(ipCity))
                    {
                        ipCity = ipCity.Replace("IANA保留地址  CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":";
                    }

                    string FilePath = System.Web.HttpContext.Current.Server.MapPath("/log/loginip/" + UsId + "_" + DESEncrypt.Encrypt(UsId.ToString(), "kubaoLogenpt") + ".log");
                    LogHelper.Write(FilePath, "" + ipCity + "" + MyIP + "(登录)");
                }
            }
            catch { }
            //----------------------写入日志文件作永久保存
            new BCW.BLL.User().UpdateTime(UsId);

            //VIP隐身
            int VipLeven = BCW.User.Users.VipLeven(UsId);
            if (new BCW.BLL.Role().IsAllMode(UsId) == false && VipLeven > 0)
            {
                new BCW.BLL.User().UpdateState(UsId, 1);
            }


            Utils.Success("登录成功", "登录成功!返回登录前的页面..<br />如果没有自动跳转,请点击以下链接..", Out.SysUBB(bUrl), "2");
        }
        else
        {
            Utils.Error("登录失败,会员ID/手机号码或密码错误", "");
        }
    }