Пример #1
0
 /// <summary>
 /// me_机器人增加一条数据
 /// </summary>
 public int Add_Robot(BCW.XinKuai3.Model.XK3_Bet model)
 {
     return(dal.Add_Robot(model));
 }
Пример #2
0
    //机器人购买
    private void PlayXK3_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 = Convert.ToInt32(ub.GetSub("XK3ROBOTBUY", xmlPath));

        int    dnu = 0;
        string dsb = DateTime.Now.ToString("yyMMdd");

        dnu = int.Parse(dsb + "001");
        string where1 = string.Empty;

        where1 = "ORDER BY Lottery_issue DESC";

        BCW.XinKuai3.Model.XK3_Internet_Data model = new BCW.XinKuai3.BLL.XK3_Internet_Data().Getxk3listLast(where1);//最后一期

        //string issue2 = (Int64.Parse(model.Lottery_issue) + 1).ToString();//下一个开奖期号
        string issue3  = Utils.Right(model.Lottery_issue.ToString(), 3);//本期开奖期号的后3位
        string issue33 = model.Lottery_issue;

        BCW.XinKuai3.Model.XK3_Bet modelBuy = new BCW.XinKuai3.Model.XK3_Bet();
        if (IsOpen() == true)
        {
            modelBuy.Lottery_issue = issue33;
        }
        else
        {
            if (issue3 == "078")
            {
                modelBuy.Lottery_issue = dnu.ToString();
            }
            else
            {
                modelBuy.Lottery_issue = (issue33);//投注期号
            }
        }

        //计数出该机器人投注的次数是否大于xml限定次数
        int count = new BCW.XinKuai3.BLL.XK3_Bet().GetXK3_Bet_GetRecordCount(" UsID=" + meid + " and Lottery_issue='" + modelBuy.Lottery_issue + "'");

        if ((count < buycou) || (buycou == 0))
        {
            if (num1 == 9)//1大2小
            {
                int a11 = int.Parse(Get_DXSD());
                if (a11 == 1)
                {
                    modelBuy.DaXiao = "1";
                    modelBuy.Odds   = (decimal)Da;
                }
                else
                {
                    modelBuy.DaXiao = "2";
                    modelBuy.Odds   = (decimal)Xiao;
                }

                modelBuy.Play_Way           = 9;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DanShuang          = "";
            }
            else if (num1 == 10)//1单2双
            {
                int a22 = int.Parse(Get_DXSD());
                if (a22 == 1)
                {
                    modelBuy.DanShuang = "2";
                    modelBuy.Odds      = (decimal)Shuang;
                }
                else
                {
                    modelBuy.DanShuang = "1";
                    modelBuy.Odds      = (decimal)Dan;
                }
                modelBuy.Play_Way           = 10;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
            }
            //和值4-17
            else if (num1 == 1)
            {
                Random a3  = new Random();
                int    a33 = a3.Next(1, 15);

                switch (a33)
                {
                case 1:
                    modelBuy.Sum = "4";
                    break;

                case 2:
                    modelBuy.Sum = "5";
                    break;

                case 3:
                    modelBuy.Sum = "6";
                    break;

                case 4:
                    modelBuy.Sum = "7";
                    break;

                case 5:
                    modelBuy.Sum = "8";
                    break;

                case 6:
                    modelBuy.Sum = "9";
                    break;

                case 7:
                    modelBuy.Sum = "10";
                    break;

                case 8:
                    modelBuy.Sum = "11";
                    break;

                case 9:
                    modelBuy.Sum = "12";
                    break;

                case 10:
                    modelBuy.Sum = "13";
                    break;

                case 11:
                    modelBuy.Sum = "14";
                    break;

                case 12:
                    modelBuy.Sum = "15";
                    break;

                case 13:
                    modelBuy.Sum = "16";
                    break;

                case 14:
                    modelBuy.Sum = "17";
                    break;
                }
                modelBuy.Play_Way           = 1;
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds = 1;
            }
            //三同号通选
            else if (num1 == 2)
            {
                modelBuy.Play_Way           = 2;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "1";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }
            //三同号单选
            else if (num1 == 3)
            {
                int a55 = int.Parse(Get_danxuan());
                switch (a55)
                {
                case 1:
                    modelBuy.Three_Same_Single = "111";
                    break;

                case 2:
                    modelBuy.Three_Same_Single = "222";
                    break;

                case 3:
                    modelBuy.Three_Same_Single = "333";
                    break;

                case 4:
                    modelBuy.Three_Same_Single = "444";
                    break;

                case 5:
                    modelBuy.Three_Same_Single = "555";
                    break;

                case 6:
                    modelBuy.Three_Same_Single = "666";
                    break;
                }
                modelBuy.Play_Way           = 3;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }
            else if (num1 == 4)//三不同号-------------------再随机3个不同的数字
            {
                //随机产生3条不重复的1-6的数
                int[] result = new int[6];
                for (int i = 0; i < 6; i++)
                {
                    result[i] = i + 1;
                }
                for (int j = 5; j > 0; j--)
                {
                    Random r     = new Random();
                    int    index = r.Next(0, j);
                    int    temp  = result[index];
                    result[index] = result[j];
                    result[j]     = temp;
                }

                //冒泡排序 从大到小
                for (int i = 0; i < 3; i++)
                {
                    for (int j = i + 1; j < 3; j++)
                    {
                        if (result[j] < result[i])
                        {
                            int temp = result[i];
                            result[i] = result[j];
                            result[j] = temp;
                        }
                    }
                }

                modelBuy.Three_Same_Not    = (result[0]).ToString() + (result[1]).ToString() + (result[2]).ToString();
                modelBuy.Play_Way          = 4;
                modelBuy.Sum               = "";
                modelBuy.Three_Same_All    = "";
                modelBuy.Three_Same_Single = "";

                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds = 1;
            }
            else if (num1 == 5)//三连号
            {
                modelBuy.Play_Way           = 5;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "1";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }
            //二同号复选
            else if (num1 == 6)
            {
                int a66 = int.Parse(Get_danxuan());
                switch (a66)
                {
                case 1:
                    modelBuy.Two_Same_All = "11";
                    break;

                case 2:
                    modelBuy.Two_Same_All = "22";
                    break;

                case 3:
                    modelBuy.Two_Same_All = "33";
                    break;

                case 4:
                    modelBuy.Two_Same_All = "44";
                    break;

                case 5:
                    modelBuy.Two_Same_All = "55";
                    break;

                case 6:
                    modelBuy.Two_Same_All = "66";
                    break;
                }
                modelBuy.Play_Way           = 6;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }
            else if (num1 == 7)//二同号单选
            {
                modelBuy.Play_Way           = 7;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = Get_Two_Same_Single();
                modelBuy.Two_dissame        = "";
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }
            else if (num1 == 8)//二不同号
            {
                modelBuy.Play_Way           = 8;
                modelBuy.Sum                = "";
                modelBuy.Three_Same_All     = "";
                modelBuy.Three_Same_Single  = "";
                modelBuy.Three_Same_Not     = "";
                modelBuy.Three_Continue_All = "";
                modelBuy.Two_Same_All       = "";
                modelBuy.Two_Same_Single    = "";
                modelBuy.Two_dissame        = Get_Two_dissame2();
                modelBuy.DaXiao             = "";
                modelBuy.DanShuang          = "";
                modelBuy.Odds               = 1;
            }

            modelBuy.UsID       = meid;         //用户id
            modelBuy.Input_Time = DateTime.Now; //投注时间
            modelBuy.Zhu        = 1;            //注数----默认全部投一注。

            modelBuy.DanTuo   = "0";            //胆拖
            modelBuy.State    = 0;              //未开奖
            modelBuy.GetMoney = 0;              //获得多少酷币
            modelBuy.isRobot  = 1;


            modelBuy.Zhu_money = Price;                //每注投多少钱
            modelBuy.PutGold   = Price * modelBuy.Zhu; //总投了多少钱


            long   gold   = new BCW.BLL.User().GetGold(meid);
            long   prices = Convert.ToInt64(Price * modelBuy.Zhu);
            string mename = new BCW.BLL.User().GetUsName(meid);

            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  = "系统机器人自动操作";
                modelx.AddTime = DateTime.Now;
                new BCW.BLL.Goldlog().Add(modelx);

                BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+(" + prices + ") where id=" + meid + "");
            }

            long xPrices = Utils.ParseInt64(ub.GetSub("XK3Price", xmlPath));
            if (xPrices > 0)
            {
                long    oPrices = 0;
                DataSet ds;
                if (IsOpen() == true)
                {
                    ds = new BCW.XinKuai3.BLL.XK3_Bet().GetList("PutGold", "UsID=" + meid + " and Lottery_issue='" + issue33 + "'");
                }
                else
                {
                    if (issue3 == "078")
                    {
                        ds = new BCW.XinKuai3.BLL.XK3_Bet().GetList("PutGold", "UsID=" + meid + " and Lottery_issue='" + dnu + "'");
                    }
                    else
                    {
                        ds = new BCW.XinKuai3.BLL.XK3_Bet().GetList("PutGold", "UsID=" + meid + " and Lottery_issue='" + issue33 + "'");
                    }
                }

                DataTable dt = ds.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    int drs = int.Parse(dr[0].ToString());
                    oPrices = oPrices + drs;
                }

                if (oPrices + prices > xPrices)
                {
                    Response.End();
                }
            }

            //new BCW.BLL.User().UpdateiGold(meid, mename, -prices, 12);//新快3----更新排行榜与扣钱
            if (IsOpen() == true)
            {
                new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "" + GameName + "第" + issue33 + "期投注消费");
            }
            else
            {
                if (issue3 == "078")
                {
                    new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "" + GameName + "第" + dnu.ToString() + "期投注消费");
                }
                else
                {
                    new BCW.BLL.User().UpdateiGold(meid, mename, -prices, "" + GameName + "第" + issue33 + "期投注消费");
                }
            }
            int id = new BCW.XinKuai3.BLL.XK3_Bet().Add_Robot(modelBuy);

            new BCW.BLL.User().UpdateTime(meid, 5);// 更新会员在线时长

            ////更新排行榜
            //if (!(new BCW.XinKuai3.BLL.XK3_Toplist().Exists_usid(meid)))
            //{
            //    BCW.XinKuai3.Model.XK3_Toplist model_2 = new BCW.XinKuai3.Model.XK3_Toplist();
            //    model_2.UsId = meid;
            //    model_2.UsName = mename;
            //    model_2.WinGold = 0;
            //    model_2.PutGold = prices;
            //    new BCW.XinKuai3.BLL.XK3_Toplist().Add(model_2);
            //}
            //else
            //{
            //    BCW.XinKuai3.Model.XK3_Toplist model_1 = new BCW.XinKuai3.BLL.XK3_Toplist().GetXK3_meid(meid);

            //    long all_prices = model_1.PutGold + prices;

            //    new BCW.XinKuai3.BLL.XK3_Toplist().Update_gold(meid, all_prices);
            //}

            //动态
            string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/xk3.aspx]" + GameName + "[/url]下注**" + ub.Get("SiteBz") + "";//" + modelBuy.Zhu * modelBuy.Zhu_money + "
            new BCW.BLL.Action().Add(1001, id, meid, "", wText);
        }
    }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.XinKuai3.Model.XK3_Bet model)
 {
     dal.Update(model);
 }