Пример #1
0
    //自动游戏程序
    private void ChangePalyHc1_Robot()
    {
        //进行自动下注
        int hour = DateTime.Now.Hour;

        if (hour > 23 || hour < 9)
        {
            Response.Write("" + GameName + "_机器人已休息close1!");
        }
        else
        {
            try
            {
                BCW.Model.Game.HcList modelbuy1 = new BCW.BLL.Game.HcList().GetHcListNew(0);        //最后一期
                if (modelbuy1.EndTime > DateTime.Now)
                {
                    PlayHc1_Robot();
                    Response.Write("" + GameName + "_机器人正在工作中ok1!");
                }
                else
                {
                    Response.Write("" + GameName + "_机器人购买失败!投注时间截止close1");
                }
            }
            catch
            {
                Response.Write("" + GameName + "_机器人购买失败!系统未开期数error1");
            }
        }
    }
Пример #2
0
    //机器人购买
    private void PlayHc1_Robot()
    {
        //得到随机的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();
        }
        //得到随机的类型
        int num1 = GetPtype();
        //得到随机投注的酷币
        long Price = GetPayCent();
        //xml限定每个机器人购买次数
        int buycou = 0;

        try
        {
            buycou = Convert.ToInt32(ub.GetSub("hc1ROBOTBUY", xmlPath));
        }
        catch
        {
            buycou = 0;
        }

        long Gold = new BCW.BLL.User().GetGold(meid);

        #region 判断机器人币够不够投注

        if (Gold < Price || Gold < 0)
        {
            Response.Write("<b>机器人" + meid + "币不够!请换一个机器人或者给该机器人充值 </b><br />");
        }
        else
        {
            #region 机器人投注

            int    dnu = 0;
            string dsb = DateTime.Now.ToString("yyMMdd");
            dnu = int.Parse(dsb + "001");
            string where1 = string.Empty;
            where1 = "ORDER BY ID DESC";

            //最后一期
            DataSet ds    = new BCW.BLL.Game.HcList().GetList("top 1 id", "State=0 order by EndTime desc");
            int     maxid = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            BCW.Model.Game.HcList modelbuy1 = new BCW.BLL.Game.HcList().GetHcList(maxid);
            BCW.Model.Game.HcPay  modelbuy  = new BCW.Model.Game.HcPay();
            int count = new BCW.BLL.Game.HcList().GetcountRebot(meid);
            if ((count < buycou) || (buycou == 0))
            {
                #region 大小单双投注

                if (num1 == 5)//1大2小/3单/4双
                {
                    int a11 = int.Parse(Get_DXSD());
                    modelbuy.Types = 5;
                    if (a11 == 1)
                    {
                        modelbuy.Vote = "大";
                    }
                    else if (a11 == 2)
                    {
                        modelbuy.Vote = "小";
                    }
                    else if (a11 == 3)
                    {
                        modelbuy.Vote = "单";
                    }
                    else
                    {
                        modelbuy.Vote = "双";
                    }
                }
                #endregion
                //选号玩法
                else if (num1 == 1)
                {
                    modelbuy.Types = 1;
                    Random a3  = new Random();
                    int    a33 = a3.Next(1, 37);
                    modelbuy.Vote = Convert.ToString(a33);
                }
                //生肖玩法
                else if (num1 == 2)
                {
                    modelbuy.Types = 2;
                    Random a4  = new Random();
                    int    a44 = a4.Next(1, 13);
                    switch (a44)
                    {
                    case 1:
                        modelbuy.Vote = "鼠";
                        break;

                    case 2:
                        modelbuy.Vote = "牛";
                        break;

                    case 3:
                        modelbuy.Vote = "虎";
                        break;

                    case 4:
                        modelbuy.Vote = "兔";
                        break;

                    case 5:
                        modelbuy.Vote = "龙";
                        break;

                    case 6:
                        modelbuy.Vote = "蛇";
                        break;

                    case 7:
                        modelbuy.Vote = "马";
                        break;

                    case 8:
                        modelbuy.Vote = "羊";
                        break;

                    case 9:
                        modelbuy.Vote = "猴";
                        break;

                    case 10:
                        modelbuy.Vote = "鸡";
                        break;

                    case 11:
                        modelbuy.Vote = "狗";
                        break;

                    case 12:
                        modelbuy.Vote = "猪";
                        break;
                    }
                }
                //方位玩法
                else if (num1 == 3)
                {
                    modelbuy.Types = 3;
                    Random a5  = new Random();
                    int    a55 = a5.Next(1, 5);
                    switch (a55)
                    {
                    case 1:
                        modelbuy.Vote = "东";
                        break;

                    case 2:
                        modelbuy.Vote = "南";
                        break;

                    case 3:
                        modelbuy.Vote = "西";
                        break;

                    case 4:
                        modelbuy.Vote = "北";
                        break;
                    }
                }
                else if (num1 == 4)//四季玩法
                {
                    modelbuy.Types = 4;
                    Random a6  = new Random();
                    int    a66 = a6.Next(1, 5);
                    switch (a66)
                    {
                    case 1:
                        modelbuy.Vote = "春";
                        break;

                    case 2:
                        modelbuy.Vote = "夏";
                        break;

                    case 3:
                        modelbuy.Vote = "秋";
                        break;

                    case 4:
                        modelbuy.Vote = "东";
                        break;
                    }
                }
                //六肖中奖
                else if (num1 == 6)
                {
                    modelbuy.Types = 6;
                    int a66 = 0;
                    //随机生成6个生肖
                    string rand = "";
                    while (a66 < 6)
                    {
                        rand += GetRandomNum1()[a66];
                        rand += ",";
                        a66++;
                    }
                    modelbuy.Vote = rand;
                }
                //尾数大小
                else if (num1 == 7)
                {
                    modelbuy.Types = 7;
                    Random a7  = new Random();
                    int    a77 = a7.Next(0, 2);
                    switch (a77)
                    {
                    case 0:
                        modelbuy.Vote = "大";
                        break;

                    case 1:
                        modelbuy.Vote = "小";
                        break;
                    }
                }
                //尾数单双
                else if (num1 == 8)
                {
                    modelbuy.Types = 8;
                    Random a8  = new Random();
                    int    a88 = a8.Next(0, 2);
                    switch (a88)
                    {
                    case 0:
                        modelbuy.Vote = "单";
                        break;

                    case 1:
                        modelbuy.Vote = "双";
                        break;
                    }
                }
                //家禽0野兽1
                else if (num1 == 9)
                {
                    modelbuy.Types = 9;
                    Random a9  = new Random();
                    int    a99 = a9.Next(0, 2);
                    switch (a99)
                    {
                    case 0:
                        modelbuy.Vote = "家禽";
                        break;

                    case 1:
                        modelbuy.Vote = "野兽";
                        break;
                    }
                }

                modelbuy.UsID     = meid;         //用户id
                modelbuy.AddTime  = DateTime.Now; //投注时间
                modelbuy.State    = 0;            //未开奖
                modelbuy.WinCent  = 0;            //获得多少酷币
                modelbuy.IsSpier  = 1;
                modelbuy.BzType   = 0;
                modelbuy.Result   = "";            //开奖结果
                modelbuy.PayCent  = Price;         //每注投多少钱
                modelbuy.PayCents = Price;         //总投了多少钱
                modelbuy.CID      = modelbuy1.CID; //最新投注期数

                long   gold   = new BCW.BLL.User().GetGold(meid);
                long   prices = Convert.ToInt64(Price);
                string mename = new BCW.BLL.User().GetUsName(meid);
                modelbuy.UsName = mename;//用户名字
                if (gold < prices)
                {
                    //更新消费记录
                    BCW.Model.Goldlog modelx = new BCW.Model.Goldlog();
                    modelx.BbTag     = 3;
                    modelx.PUrl      = Utils.getPageUrl();//操作的文件名
                    modelx.UsId      = meid;
                    modelx.UsName    = mename;
                    modelx.AcGold    = prices;
                    modelx.AfterGold = gold + prices;//更新后的币数
                    modelx.AcText    = "系统机器人自动操作";
                    modelx.AddTime   = DateTime.Now;
                    new BCW.BLL.Goldlog().Add(modelx);
                    BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+(" + prices + ") where id=" + meid + "");
                }
                new BCW.BLL.User().UpdateiGold(meid, mename, -prices, 1001);//新快3----更新排行榜与扣钱
                new BCW.BLL.Game.HcPay().Add(modelbuy);
                new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "好彩1" + modelbuy1.CID + "期投注消费");
                new BCW.BLL.Game.HcList().Update1(modelbuy1.CID, prices, 1);                                                                                            //更新下注总额和下注额
                ChanageOnline(meid);                                                                                                                                    //邵广林 增加机器人在线时长
                //动态
                string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/hc1.aspx]" + GameName + "[/url]下注**" + ub.Get("SiteBz") + ""; //" + prices + "
                new BCW.BLL.Action().Add(1001, 1, meid, "", wText);
            }
            #endregion
        }
        #endregion
    }