예제 #1
0
파일: HP3Buy.cs 프로젝트: radtek/GitKB288
 /// <summary>
 /// 增加一条购彩记录
 /// </summary>
 public int Add(BCW.HP3.Model.HP3Buy model)
 {
     return(dal.Add(model));
 }
예제 #2
0
파일: HP3Buy.cs 프로젝트: radtek/GitKB288
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BCW.HP3.Model.HP3Buy model)
 {
     return(dal.Update(model));
 }
예제 #3
0
    //机器人ROBOT
    public void Robot()
    {
        string buycount   = ub.GetSub("HP3ROBOTBUY", xmlPath);
        int    buycou     = Convert.ToInt32(buycount);
        string RoBotCost1 = ub.GetSub("HP3ROBOTCOST", xmlPath);

        //得到投注的酷币
        string[] ppp       = RoBotCost1.Split('#');
        Random   ran       = new Random();
        int      k         = ran.Next(0, (ppp.Length));
        long     RoBotCost = Convert.ToInt32(ppp[k]);
        int      meid      = GetUsID();//下注ID

        ChanageOnline(meid);
        BCW.HP3.Model.HP3_kjnum model2 = new BCW.HP3.Model.HP3_kjnum();
        model2 = new BCW.HP3.BLL.HP3_kjnum().GetListLast();
        int      dnu    = int.Parse(model2.datenum);
        DateTime kjtime = model2.datetime;

        BCW.HP3.Model.HP3Buy modelBuy = new BCW.HP3.Model.HP3Buy();
        int[]    xx  = new int[] { 1, 6, 7, 9, 11, 13, 15, 17 };
        string[] xx2 = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
        int      x;
        Random   r = new Random();

        x = r.Next(0, 8);
        modelBuy.BuyType = xx[x];
        modelBuy.BuyID   = meid;
        modelBuy.BuyTime = DateTime.Now;
        modelBuy.BuyDate = dnu.ToString();
        Random Od  = new Random();
        int    Odd = Od.Next(1, 99);
        int    zhu = 1;

        System.Threading.Thread.Sleep(100);//当前休眠100毫秒
        if (modelBuy.BuyType == 1)
        {
            int    x2;
            Random r2 = new Random();
            x2 = r2.Next(1, 52);
            modelBuy.BuyNum   = x2.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
            modelBuy.BuyZhu   = 1;
        }
        else if (modelBuy.BuyType == 17)
        {
            string x3 = string.Empty;
            Random r3 = new Random();
            x3 = r3.Next(1, 5).ToString();
            modelBuy.BuyNum   = x3;
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
            modelBuy.BuyZhu   = 1;
        }
        else if (modelBuy.BuyType == 6)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(1, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        else if (modelBuy.BuyType == 7)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(2, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        else if (modelBuy.BuyType == 9)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(3, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        else if (modelBuy.BuyType == 11)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(4, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        else if (modelBuy.BuyType == 13)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(5, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        else if (modelBuy.BuyType == 15)
        {
            int    x6;
            Random r6 = new Random();
            x6 = r6.Next(6, 14);
            int[] arrayK = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            RandomKDiffer(x6, arrayK);
            string sbb = "";
            for (int s = 0; s < x6; s++)
            {
                if (s != x6 - 1)
                {
                    sbb = sbb + xx2[arrayK[s]] + ",";
                }
                else
                {
                    sbb = sbb + xx2[arrayK[s]];
                }
            }
            modelBuy.BuyNum   = sbb.ToString();
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd;
        }
        int    ptype = modelBuy.BuyType;
        string Num2  = modelBuy.BuyNum;

        if (ptype == 6)//直1
        {
            int len = Num2.Length;
            zhu = (len + 1) / 2;
        }
        else if (ptype == 7)//直2
        {
            int len  = Num2.Length;
            int Anum = (len + 1) / 2;
            switch (Anum)
            {
            case 2:
                zhu = 1;
                break;

            case 3:
                zhu = 3;
                break;

            case 4:
                zhu = 6;
                break;

            case 5:
                zhu = 10;
                break;

            case 6:
                zhu = 15;
                break;

            case 7:
                zhu = 21;
                break;

            case 8:
                zhu = 28;
                break;

            case 9:
                zhu = 36;
                break;

            case 10:
                zhu = 45;
                break;

            case 11:
                zhu = 55;
                break;

            case 12:
                zhu = 66;
                break;

            case 13:
                zhu = 78;
                break;
            }
        }

        else if (ptype == 9)//直3
        {
            int len  = Num2.Length;
            int Anum = (len + 1) / 2;
            switch (Anum)
            {
            case 3:
                zhu = 1;
                break;

            case 4:
                zhu = 4;
                break;

            case 5:
                zhu = 10;
                break;

            case 6:
                zhu = 20;
                break;

            case 7:
                zhu = 35;
                break;

            case 8:
                zhu = 56;
                break;

            case 9:
                zhu = 84;
                break;

            case 10:
                zhu = 120;
                break;

            case 11:
                zhu = 165;
                break;

            case 12:
                zhu = 220;
                break;

            case 13:
                zhu = 288;
                break;
            }
        }
        else if (ptype == 11)//直4
        {
            int len  = Num2.Length;
            int Anum = (len + 1) / 2;
            switch (Anum)
            {
            case 4:
                zhu = 1;
                break;

            case 5:
                zhu = 5;
                break;

            case 6:
                zhu = 15;
                break;

            case 7:
                zhu = 35;
                break;

            case 8:
                zhu = 70;
                break;

            case 9:
                zhu = 126;
                break;

            case 10:
                zhu = 210;
                break;

            case 11:
                zhu = 330;
                break;

            case 12:
                zhu = 495;
                break;

            case 13:
                zhu = 715;
                break;
            }
        }
        else if (ptype == 13)//直5
        {
            int len  = Num2.Length;
            int Anum = (len + 1) / 2;
            switch (Anum)
            {
            case 5:
                zhu = 1;
                break;

            case 6:
                zhu = 6;
                break;

            case 7:
                zhu = 21;
                break;

            case 8:
                zhu = 56;
                break;

            case 9:
                zhu = 126;
                break;

            case 10:
                zhu = 252;
                break;

            case 11:
                zhu = 462;
                break;

            case 12:
                zhu = 792;
                break;

            case 13:
                zhu = 1287;
                break;
            }
        }
        else if (ptype == 15)//直6
        {
            int len  = Num2.Length;
            int Anum = (len + 1) / 2;
            switch (Anum)
            {
            case 6:
                zhu = 1;
                break;

            case 7:
                zhu = 7;
                break;

            case 8:
                zhu = 28;
                break;

            case 9:
                zhu = 84;
                break;

            case 10:
                zhu = 210;
                break;

            case 11:
                zhu = 462;
                break;

            case 12:
                zhu = 924;
                break;

            case 13:
                zhu = 1716;
                break;
            }
        }
        modelBuy.BuyZhu = zhu;
        string buynum = modelBuy.BuyNum;

        if (modelBuy.BuyType == 1)
        {
            switch (buynum)
            {
            case "1":
            case "2":
            case "3":
            case "4":
                modelBuy.Odds = Convert.ToDecimal(XML(2));
                break;

            case "5":
                modelBuy.Odds = Convert.ToDecimal(XML(1));
                break;

            case "6":
            case "7":
            case "8":
            case "9":
            case "10":
            case "11":
            case "12":
            case "13":
            case "14":
            case "15":
            case "16":
            case "17":
                modelBuy.Odds = Convert.ToDecimal(XML(6));
                break;

            case "18":
                modelBuy.Odds = Convert.ToDecimal(XML(5));
                break;

            case "19":
            case "20":
            case "21":
            case "22":
                modelBuy.Odds = Convert.ToDecimal(XML(4));
                break;

            case "23":
                modelBuy.Odds = Convert.ToDecimal(XML(3));
                break;

            case "24":
            case "25":
            case "26":
            case "27":
            case "28":
            case "29":
            case "30":
            case "31":
            case "32":
            case "33":
            case "34":
            case "35":
            case "36":
                modelBuy.Odds = Convert.ToDecimal(XML(8));
                break;

            case "37":
                modelBuy.Odds = Convert.ToDecimal(XML(7));
                break;

            case "38":
            case "39":
            case "40":
            case "41":
            case "42":
            case "43":
            case "44":
            case "45":
            case "46":
            case "47":
            case "48":
            case "49":
            case "50":
                modelBuy.Odds = Convert.ToDecimal(XML(10));
                break;

            case "51":
                modelBuy.Odds = Convert.ToDecimal(XML(9));
                break;
            }
        }
        else if (modelBuy.BuyType == 6)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(11));
        }
        else if (modelBuy.BuyType == 7)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(12));
        }
        else if (modelBuy.BuyType == 9)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(13));
        }
        else if (modelBuy.BuyType == 11)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(14));
        }
        else if (modelBuy.BuyType == 13)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(15));
        }
        else if (modelBuy.BuyType == 15)
        {
            modelBuy.Odds = Convert.ToDecimal(XML(16));
        }
        else if (modelBuy.BuyType == 17)
        {
            switch (modelBuy.BuyNum)
            {
            case "1":
                modelBuy.Odds = Convert.ToDecimal(XML(21));
                break;

            case "2":
                modelBuy.Odds = Convert.ToDecimal(XML(22));
                break;

            case "3":
                modelBuy.Odds = Convert.ToDecimal(XML(23));
                break;

            case "4":
                modelBuy.Odds = Convert.ToDecimal(XML(24));
                break;
            }
        }


        int count = new BCW.HP3.BLL.HP3Buy().GetRecordCount(" BuyID=" + meid + " and BuyDate='" + modelBuy.BuyDate + "'");

        long big = Convert.ToInt64(ub.GetSub("HP3BigPay", xmlPath));

        while (modelBuy.BuyMoney > big)
        {
            Random Od2  = new Random();
            int    Odd2 = Od2.Next(1, 99);
            modelBuy.BuyMoney = Convert.ToInt64(RoBotCost) * Odd2;
        }
        long xPrices = Utils.ParseInt64(ub.GetSub("HP3Price", xmlPath));
        long prices  = Convert.ToInt64(modelBuy.BuyMoney * modelBuy.BuyZhu);

        long SmallPay = Utils.ParseInt64(ub.GetSub("HP3SmallPay", xmlPath));
        long BigPay   = Utils.ParseInt64(ub.GetSub("HP3BigPay", xmlPath));

        if (prices >= SmallPay && prices <= BigPay)
        {
            if (xPrices > 0)
            {
                DataSet   ds      = new BCW.HP3.BLL.HP3Buy().GetListByID("BuyMoney", meid, modelBuy.BuyDate);
                int       oPrices = 0;
                DataTable dt      = ds.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    int drs = int.Parse(dr[0].ToString());
                    oPrices = oPrices + drs;
                }
                int end2      = int.Parse(GetLastStr(model2.datenum, 2));
                int LiangTing = int.Parse(ub.GetSub("HP3LianTing", xmlPath));

                long   gold   = new BCW.BLL.User().GetGold(meid);
                string mename = new BCW.BLL.User().GetUsName(meid);


                if (count < buycou && oPrices + prices < xPrices && gold >= 0)
                {
                    if (gold >= prices)
                    {
                        int Sec = Utils.ParseInt(ub.GetSub("HP3Sec", xmlPath));
                        if (kjtime < DateTime.Now.AddSeconds(Sec))
                        {
                            Response.Write("未到下注时间ok1");
                        }
                        else
                        {
                            string xfjl = "";
                            if (modelBuy.BuyType == 1)
                            {
                                xfjl = speChoose(Convert.ToInt32(modelBuy.BuyNum));
                            }
                            else if (modelBuy.BuyType == 17)
                            {
                                switch (modelBuy.BuyNum)
                                {
                                case "1":
                                    xfjl = "大";
                                    break;

                                case "2":
                                    xfjl = "小";
                                    break;

                                case "3":
                                    xfjl = "单";
                                    break;

                                case "4":
                                    xfjl = "双";
                                    break;
                                }
                            }
                            else
                            {
                                switch (modelBuy.BuyType)
                                {
                                case 6:
                                    xfjl = "任选一:" + modelBuy.BuyNum;
                                    break;

                                case 7:
                                    xfjl = "任选二:" + modelBuy.BuyNum;
                                    break;

                                case 8:
                                    xfjl = "任选二胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 9:
                                    xfjl = "任选三:" + modelBuy.BuyNum;
                                    break;

                                case 10:
                                    xfjl = "任选三胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 11:
                                    xfjl = "任选四:" + modelBuy.BuyNum;
                                    break;

                                case 12:
                                    xfjl = "任选四胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 13:
                                    xfjl = "任选五:" + modelBuy.BuyNum;
                                    break;

                                case 14:
                                    xfjl = "任选五胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 15:
                                    xfjl = "任选六:" + modelBuy.BuyNum;
                                    break;

                                case 16:
                                    xfjl = "任选六胆拖:" + modelBuy.BuyNum;
                                    break;
                                }
                            }


                            int id = new BCW.HP3.BLL.HP3Buy().Add(modelBuy);
                            new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "" + GameName + "第" + "[url=./game/HP3.aspx?act=BuyWin&qihaos=" + modelBuy.BuyDate + "&amp;ptype=2]" + modelBuy.BuyDate + "[/url]期买" + xfjl + "投注ID" + id);
                            new BCW.HP3.BLL.HP3Buy().UpdateIsRot(id, 1);
                            new BCW.HP3.BLL.HP3Buy().UpdateWillGet(id, 0);
                            string gameplay = "";
                            switch (modelBuy.BuyType)
                            {
                            case 1:
                                gameplay = "花色连号同号投注";
                                break;

                            case 17:
                                gameplay = "大小单双投注";
                                break;

                            default:
                                gameplay = "任选投注";
                                break;
                            }
                            //动态
                            string wText = "在[url=/bbs/game/HP3.aspx]" + GameName + "[/url]《" + gameplay + "》下注**" + "" + ub.Get("SiteBz") + "";// + prices
                            new BCW.BLL.Action().Add(1003, id, meid, mename, wText);
                        }
                    }
                    else
                    {
                        // if (gold < prices)
                        //更新消费记录
                        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    = prices;
                        modelx.AfterGold = gold + prices;//更新后的币数
                        modelx.AcText    = "HP3系统机器人自动操作";
                        modelx.AddTime   = DateTime.Now;
                        new BCW.BLL.Goldlog().Add(modelx);

                        //给机器人发钱
                        BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+(" + prices + ") where id=" + meid + "");


                        int Sec = Utils.ParseInt(ub.GetSub("HP3Sec", xmlPath));
                        if (kjtime < DateTime.Now.AddSeconds(Sec))
                        {
                            Response.Write("未到下注时间ok1");
                        }
                        else
                        {
                            string xfjl = "";
                            if (modelBuy.BuyType == 1)
                            {
                                xfjl = speChoose(Convert.ToInt32(modelBuy.BuyNum));
                            }
                            else if (modelBuy.BuyType == 17)
                            {
                                switch (modelBuy.BuyNum)
                                {
                                case "1":
                                    xfjl = "大";
                                    break;

                                case "2":
                                    xfjl = "小";
                                    break;

                                case "3":
                                    xfjl = "单";
                                    break;

                                case "4":
                                    xfjl = "双";
                                    break;
                                }
                            }
                            else
                            {
                                switch (modelBuy.BuyType)
                                {
                                case 6:
                                    xfjl = "任选一:" + modelBuy.BuyNum;
                                    break;

                                case 7:
                                    xfjl = "任选二:" + modelBuy.BuyNum;
                                    break;

                                case 8:
                                    xfjl = "任选二胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 9:
                                    xfjl = "任选三:" + modelBuy.BuyNum;
                                    break;

                                case 10:
                                    xfjl = "任选三胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 11:
                                    xfjl = "任选四:" + modelBuy.BuyNum;
                                    break;

                                case 12:
                                    xfjl = "任选四胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 13:
                                    xfjl = "任选五:" + modelBuy.BuyNum;
                                    break;

                                case 14:
                                    xfjl = "任选五胆拖:" + modelBuy.BuyNum;
                                    break;

                                case 15:
                                    xfjl = "任选六:" + modelBuy.BuyNum;
                                    break;

                                case 16:
                                    xfjl = "任选六胆拖:" + modelBuy.BuyNum;
                                    break;
                                }
                            }


                            int id = 0;
                            try
                            {
                                id = new BCW.HP3.BLL.HP3Buy().Add(modelBuy);
                                new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "" + GameName + "第" + "[url=./game/HP3.aspx?act=BuyWin&qihaos=" + modelBuy.BuyDate + "&amp;ptype=2]" + modelBuy.BuyDate + "[/url]期买" + xfjl + "投注ID" + id);
                                new BCW.HP3.BLL.HP3Buy().UpdateIsRot(id, 1);
                                new BCW.HP3.BLL.HP3Buy().UpdateWillGet(id, 0);
                                string gameplay = "";
                                switch (modelBuy.BuyType)
                                {
                                case 1:
                                    gameplay = "花色连号同号投注";
                                    break;

                                case 17:
                                    gameplay = "大小单双投注";
                                    break;

                                default:
                                    gameplay = "任选投注";
                                    break;
                                }
                                //动态
                                string wText = "在[url=/bbs/game/HP3.aspx]" + GameName + "[/url]《" + gameplay + "》下注**" + "" + ub.Get("SiteBz") + "";//+ prices
                                new BCW.BLL.Action().Add(1003, id, meid, mename, wText);
                            }
                            catch { }
                        }
                    }

                    int countall = new BCW.HP3.BLL.HP3Buy().GetRecordCount("  BuyDate='" + modelBuy.BuyDate + "'");
                    Response.Write("第" + modelBuy.BuyDate + "期<br />");
                    Response.Write("机器人总计买了" + countall + "张<br />");
                }
            }
        }
    }