private void StatPage() { Master.Title = "赢利分析"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("赢利分析"); builder.Append(Out.Tab("</div>", "<br />")); double Tar1 = Convert.ToDouble(ub.GetSub("DxdiceTar", xmlPath)); //今天赢利 long TodayWinCent1 = new BCW.BLL.Game.Dxdice().GetPrice("BzType=0 and State>0 and Year(AddTime) = " + DateTime.Now.Year + " AND Month(AddTime) = " + DateTime.Now.Month + " and Day(AddTime) = " + DateTime.Now.Day + ""); long TodayWin1 = Convert.ToInt64(TodayWinCent1 * Tar1 * 0.01); //昨天赢利 long YesWinCent1 = new BCW.BLL.Game.Dxdice().GetPrice("BzType=0 and State>0 and Year(AddTime) = " + DateTime.Now.AddDays(-1).Year + " AND Month(AddTime) = " + DateTime.Now.AddDays(-1).Month + " and Day(AddTime) = " + DateTime.Now.AddDays(-1).Day + " "); long YesWin1 = Convert.ToInt64(YesWinCent1 * Tar1 * 0.01); //本月赢利 long MonthWinCent1 = new BCW.BLL.Game.Dxdice().GetPrice("BzType=0 and State>0 and Year(AddTime) = " + (DateTime.Now.Year) + " AND Month(AddTime) = " + (DateTime.Now.Month) + " "); long MonthWin1 = Convert.ToInt64(MonthWinCent1 * Tar1 * 0.01); //上月赢利 long Month2WinCent1 = new BCW.BLL.Game.Dxdice().GetPrice("BzType=0 and State>0 and Year(AddTime) = " + (DateTime.Now.Year - DateTime.Now.Day) + " AND Month(AddTime) = " + (DateTime.Now.Month - DateTime.Now.Day) + " "); long Month2Win1 = Convert.ToInt64(Month2WinCent1 * Tar1 * 0.01); long WinCent1 = new BCW.BLL.Game.Dxdice().GetPrice("BzType=0 and State>0"); long Win1 = Convert.ToInt64(WinCent1 * Tar1 * 0.01); builder.Append(Out.Tab("<div>", "")); builder.Append("今天赢利:" + (TodayWin1) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("昨天赢利:" + (YesWin1) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("本月赢利:" + (MonthWin1) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("上月赢利:" + (Month2Win1) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("赢利总计:" + (Win1) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getPage("dxdice.aspx") + "\">返回上一级</a><br />"); builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>")); builder.Append(Out.Tab("</div>", "<br />")); }
/// <summary> /// 掷骰自动游戏程序 /// </summary> /// <param name="DxdiceId">局数ID</param> /// <param name="dt">截止时间</param> private void ChangePalyDxdice() { int UsIDNum = new BCW.BLL.Game.Dxdice().GetCountState(0);//多少未结束的掷骰 //如果小于5个则自动出动1个ID来开掷骰 if (UsIDNum < 5) { PlayDxdice(0); } //应战 PlayDxdice2(0); }
private void ReloadPage() { Master.Title = "掷骰管理"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">游戏</a>>"); builder.Append("掷骰"); builder.Append(Out.Tab("</div>", "<br />")); string ac = Utils.GetRequest("ac", "all", 1, "", ""); int uid = int.Parse(Utils.GetRequest("uid", "all", 1, @"^[1-9]\d*$", "0")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = string.Empty; if (uid > 0) { if (Utils.ToSChinese(ac) == "应战") { strWhere += "reid=" + uid + ""; } else { strWhere += "usid=" + uid + ""; } } string[] pageValUrl = { "ac", "act", "uid", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } // 开始读取列表 IList <BCW.Model.Game.Dxdice> listDxdice = new BCW.BLL.Game.Dxdice().GetDxdices(pageIndex, pageSize, strWhere, out recordCount); if (listDxdice.Count > 0) { int k = 1; foreach (BCW.Model.Game.Dxdice n in listDxdice) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } string bzText = string.Empty; if (n.BzType == 0) { bzText = ub.Get("SiteBz"); } else { bzText = ub.Get("SiteBz2"); } string TrueText = string.Empty; if (Utils.GetDomain().Contains("kubao") || Utils.GetDomain().Contains("tuhao") || Utils.GetDomain().Contains("th") || Utils.GetDomain().Contains("kb288")) { int ManageId = new BCW.User.Manage().IsManageLogin(); if (ManageId == 1) { TrueText = "/庄" + n.DxdiceA + "/闲" + ((n.DxdiceB == "") ? "xx" : n.DxdiceB) + ""; } } else { TrueText = "/庄" + n.DxdiceA + "/闲" + ((n.DxdiceB == "") ? "xx" : n.DxdiceB) + ""; } builder.Append("<a href=\"" + Utils.getUrl("dxdice.aspx?act=del&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[删]></a>"); builder.Append("" + ((pageIndex - 1) * pageSize + k) + ".<a href=\"" + Utils.getUrl("dxdice.aspx?act=view&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + n.UsName + "</a>(" + n.Price + "" + bzText + "" + TrueText + ")"); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } string strText = "输入用户ID:/,"; string strName = "uid,backurl"; string strType = "num,hidden"; string strValu = "'" + Utils.getPage(0) + ""; string strEmpt = "true,false"; string strIdea = "/"; string strOthe = "搜掷骰|应战,dxdice.aspx,post,1,red|blue"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("dxdice.aspx?act=stat") + "\">赢利分析</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("dxdice.aspx?act=reset") + "\">重置游戏</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("../xml/dxdiceset.aspx?backurl=" + Utils.PostPage(1) + "") + "\">游戏配置</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("../toplist.aspx?act=top&ptype=10&backurl=" + Utils.PostPage(1) + "") + "\">排行榜单</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>"); builder.Append(Out.Tab("</div>", "<br />")); }
private void ViewPage() { int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误")); int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[1-2]\d*$", "1")); BCW.Model.Game.Dxdice model = new BCW.BLL.Game.Dxdice().GetDxdice(id); if (model == null) { Utils.Error("不存在的记录", ""); } Master.Title = "查看掷骰"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("查看掷骰"); builder.Append(Out.Tab("</div>", "<br />")); int zDiceNum = (Utils.ParseInt(Utils.Left(model.DxdiceA, 1)) + Utils.ParseInt(Utils.Right(model.DxdiceA, 1))); int kDiceNum = (Utils.ParseInt(Utils.Left(model.DxdiceB, 1)) + Utils.ParseInt(Utils.Right(model.DxdiceB, 1))); string bzText = string.Empty; if (model.BzType == 0) { bzText = ub.Get("SiteBz"); } else { bzText = ub.Get("SiteBz2"); } bool IsSeen = true; if (Utils.GetDomain().Contains("kubao") || Utils.GetDomain().Contains("tuhao") || Utils.GetDomain().Contains("th") || Utils.GetDomain().Contains("kb288")) { if (model.State == 0) { int ManageId = new BCW.User.Manage().IsManageLogin(); if (ManageId != 1 && ManageId != 11) { IsSeen = false; } } } builder.Append(Out.Tab("<div>", "")); builder.Append(DT.FormatDate(model.AddTime, 0) + "<br />"); builder.Append("庄家:<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx?uid=" + model.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + model.UsName + "(" + model.UsID + ")</a><br />"); if (IsSeen == true) { builder.Append("庄家掷骰:" + zDiceNum + "点(" + model.DxdiceA + ")<br />"); } else { builder.Append("庄家掷骰:xx点(xx,xx)<br />"); } builder.Append("掷骰:" + model.Price + "" + bzText + "<br />"); if (model.ReID > 0 && model.State != 4) { builder.Append("闲家:<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx?uid=" + model.ReID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + model.ReName + "(" + model.ReID + ")</a><br />"); builder.Append("闲家掷骰:" + kDiceNum + "点(" + model.DxdiceB + ")"); } else { builder.Append("闲家:等待挑战<br />"); builder.Append("闲家掷骰:庄家掷骰:xx点(xx,xx)"); } if (model.State == 1 || model.State == 2) { builder.Append("开奖结果:"); int iWin = GetiWin(model.DxdiceA, model.DxdiceB); if (iWin == 1) { builder.Append("庄家全赢"); } else if (iWin == 2) { builder.Append("双方打和"); } else if (iWin == 3) { builder.Append("闲家全赢"); } } else if (model.State == 3) { builder.Append("状态:过期返还" + model.Price + "" + bzText + ""); } else if (model.State == 4) { builder.Append("状态:已经撤销"); } builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("dxdice.aspx?act=del&id=" + id + "&backurl=" + Utils.getPage(0) + "") + "\">删除掷骰</a><br />"); builder.Append("<a href=\"" + Utils.getPage("dxdice.aspx") + "\">返回上一级</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>"); builder.Append(Out.Tab("</div>", "<br />")); }
//下注操作 private void PlayDxdice(int meid) { if (meid == 0) { meid = GetUsID(); } ChanageOnline(meid); //币的类型 int bzType = new Random().Next(0, 2); long paycent = GetPayCent(); if (bzType == 1) { paycent = paycent * 10; } 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"); } if (paycent > gold) { //更新消费记录 BCW.Model.Goldlog modelx = new BCW.Model.Goldlog(); modelx.BbTag = 3; modelx.Types = bzType; modelx.PUrl = Utils.getPageUrl();//操作的文件名 modelx.UsId = meid; modelx.UsName = mename; modelx.AcGold = 500000; modelx.AfterGold = gold + 500000;//更新后的币数 modelx.AcText = "系统机器人自动操作"; modelx.AddTime = DateTime.Now; new BCW.BLL.Goldlog().Add(modelx); if (bzType == 0) { BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+500000 where id=" + meid + ""); } else { BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iMoney=iMoney+500000 where id=" + meid + ""); } } if (bzType == 0) { new BCW.BLL.User().UpdateiGold(meid, mename, -paycent, "掷骰消费"); } else { new BCW.BLL.User().UpdateiMoney(meid, mename, -paycent, "掷骰消费"); } Random rd = new Random(unchecked ((int)DateTime.Now.Ticks)); int A = rd.Next(1, 7); int B = rd.Next(1, 7); if (A + B < 5) { if (A > B) { A = A + rd.Next(1, 3); } else { B = B + rd.Next(1, 3); } } BCW.Model.Game.Dxdice model = new BCW.Model.Game.Dxdice(); model.Types = 0; model.DxdiceA = A + "#" + B; model.DxdiceB = ""; model.StopTime = DateTime.Now.AddHours(1); model.UsID = meid; model.UsName = mename; model.AddTime = DateTime.Now; model.ReID = 0; model.ReName = ""; model.Price = paycent; model.IsWin = 0; model.State = 0; model.BzType = bzType; int id = new BCW.BLL.Game.Dxdice().Add(model); string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/dxdice.aspx]大小掷骰[/url]开盘成功(" + paycent + "" + bzText + ")"; new BCW.BLL.Action().Add(18, id, 0, "", wText); }
//应战操作 private void PlayDxdice2(int meid) { if (meid == 0) { meid = GetUsID(); } ChanageOnline(meid); DataSet ds = new BCW.BLL.Game.Dxdice().GetList("ID", "Types=0 and State=0 and UsID<>" + meid + " and AddTime<'" + DateTime.Now.AddMinutes(-20) + "' ORDER BY NEWID()"); if (ds != null && ds.Tables[0].Rows.Count > 0) { int TNum = Utils.ParseInt(ub.GetSub("DxdiceTNum", xmlPath)); if (TNum > 0) { int TCount2 = new BCW.BLL.Game.Dxdice().GetCount2(meid); if (TCount2 > TNum) { int TCount = new BCW.BLL.Game.Dxdice().GetCount(meid); if ((TCount2 - TNum) > Convert.ToInt32(TCount * TNum)) { PlayDxdice(0); meid = GetUsID(); } } } string mename = new BCW.BLL.User().GetUsName(meid); int id = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); BCW.Model.Game.Dxdice model = new BCW.BLL.Game.Dxdice().GetDxdice(id); long gold = 0; string bzText = string.Empty; if (model.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"); } if (model.Price > gold) { //更新消费记录 BCW.Model.Goldlog modelx = new BCW.Model.Goldlog(); modelx.BbTag = 3; modelx.Types = model.BzType; modelx.PUrl = Utils.getPageUrl();//操作的文件名 modelx.UsId = meid; modelx.UsName = mename; modelx.AcGold = 500000; modelx.AfterGold = gold + 500000;//更新后的币数 modelx.AcText = "系统机器人自动操作"; modelx.AddTime = DateTime.Now; new BCW.BLL.Goldlog().Add(modelx); if (model.BzType == 0) { BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iGold=iGold+500000 where id=" + meid + ""); } else { BCW.Data.SqlHelper.ExecuteSql("Update tb_User set iMoney=iMoney+500000 where id=" + meid + ""); } } //操作币 long winMoney = model.Price; //税率 long SysTax = 0; int Tax = Utils.ParseInt(ub.GetSub("DxdiceTar", xmlPath)); if (Tax > 0) { SysTax = Convert.ToInt64(winMoney * Tax * 0.01); } winMoney = winMoney - SysTax; //庄家是不是机器人 bool IsRobot = false; if (new BCW.BLL.User().GetIsSpier(model.UsID) == 1) { IsRobot = true; } Random rd = new Random(unchecked ((int)DateTime.Now.Ticks)); int C = rd.Next(1, 7); int D = rd.Next(1, 7); int IsWin = 0; int iWin = GetiWin(model.DxdiceA, "" + C + "#" + D + ""); if (iWin == 3) { //消费 if (model.BzType == 0) { new BCW.BLL.User().UpdateiGold(meid, mename, winMoney, 10); new BCW.BLL.User().UpdateiGoldTop(model.UsID, model.UsName, -model.Price, 10); } else { new BCW.BLL.User().UpdateiMoney(meid, mename, winMoney, "掷骰消费"); } //内线与动态 if (!IsRobot) { new BCW.BLL.Guest().Add(1, model.UsID, model.UsName, "您的掷骰已经结束,参与庄家[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url],结果对方掷了" + C + "#" + D + "点战胜了你掷的" + model.DxdiceA + "点![url=/bbs/game/dxdice.aspx?act=add]我要继续掷骰[/url]"); } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/dxdice.aspx]大小掷骰[/url]以" + C + "#" + D + "点战胜了" + model.UsName + "掷的" + model.DxdiceA + "点(赢" + model.Price + "" + bzText + ")"; new BCW.BLL.Action().Add(18, id, 0, "", wText); } else if (iWin == 2) { IsWin = 2;//打平 //内线与动态 if (!IsRobot) { new BCW.BLL.Guest().Add(1, model.UsID, model.UsName, "您的掷骰已经结束,参与庄家[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url],结果对方掷了" + C + "#" + D + "点打平了你掷的" + model.DxdiceA + "点![url=/bbs/game/dxdice.aspx?act=case]马上兑奖[/url]"); } else//自动兑换 { new BCW.BLL.Game.Dxdice().UpdateState(id, 2); if (model.BzType == 0) { new BCW.BLL.User().UpdateiGold(model.UsID, model.Price, "掷骰消费"); } else { new BCW.BLL.User().UpdateiMoney(model.UsID, model.Price, "掷骰消费"); } } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/dxdice.aspx]大小掷骰[/url]以" + C + "#" + D + "点打平" + model.UsName + "掷的" + model.DxdiceA + "点"; new BCW.BLL.Action().Add(18, id, 0, "", wText); } else { IsWin = 1; //消费 if (model.BzType == 0) { new BCW.BLL.User().UpdateiGold(meid, mename, -model.Price, 10); new BCW.BLL.User().UpdateiGoldTop(model.UsID, model.UsName, winMoney, 10); } else { new BCW.BLL.User().UpdateiMoney(meid, mename, -model.Price, "掷骰消费"); } //内线与动态 if (!IsRobot) { new BCW.BLL.Guest().Add(1, model.UsID, model.UsName, "您的掷骰已经结束,参与庄家[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url],结果对方掷了" + C + "#" + D + "点负了你掷的" + model.DxdiceA + "点![url=/bbs/game/dxdice.aspx?act=case]马上兑奖[/url]"); } else//自动兑换 { new BCW.BLL.Game.Dxdice().UpdateState(id, 2); if (model.BzType == 0) { new BCW.BLL.User().UpdateiGold(model.UsID, winMoney, "掷骰消费"); } else { new BCW.BLL.User().UpdateiMoney(model.UsID, winMoney, "掷骰消费"); } } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/dxdice.aspx]大小掷骰[/url]以" + C + "#" + D + "点负了" + model.UsName + "掷的" + model.DxdiceA + "点(输" + model.Price + "" + bzText + ")"; new BCW.BLL.Action().Add(18, id, 0, "", wText); } //更新掷骰记录 BCW.Model.Game.Dxdice m = new BCW.Model.Game.Dxdice(); m.ID = id; m.ReID = meid; m.DxdiceB = C + "#" + D; m.ReName = mename; m.ReTime = DateTime.Now; m.IsWin = IsWin; m.State = 1; new BCW.BLL.Game.Dxdice().UpdateState(m); } }