예제 #1
0
파일: BQCPay.cs 프로젝트: radtek/GitKB288
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BCW.BQC.Model.BQCPay model)
 {
     return(dal.Add(model));
 }
예제 #2
0
파일: BQCPay.cs 프로젝트: radtek/GitKB288
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.BQC.Model.BQCPay model)
 {
     dal.Update(model);
 }
예제 #3
0
    //机器人ROBOT
    public void Robot()
    {
        string xml      = ub.GetSub("IsBot", xmlPath);
        int    buycount = int.Parse(ub.GetSub("RoBotCount", xmlPath));//次数

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

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

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

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

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


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

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


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

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

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

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

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