private void BackSavePage(string act) { DateTime sTime = Utils.ParseTime(Utils.GetRequest("sTime", "post", 2, DT.RegexTime, "开始时间填写无效")); DateTime oTime = Utils.ParseTime(Utils.GetRequest("oTime", "post", 2, DT.RegexTime, "结束时间填写无效")); int iTar = Utils.ParseInt(Utils.GetRequest("iTar", "post", 2, @"^[0-9]\d*$", "千分比填写错误")); int iPrice = Utils.ParseInt(Utils.GetRequest("iPrice", "post", 2, @"^[0-9]\d*$", "至少多少币才返填写错误")); if (act == "backsave") { DataSet ds = new BCW.BLL.Game.Horsepay().GetList("UsID,sum(WinCent-BuyCent) as WinCents", "AddTime>='" + sTime + "'and AddTime<'" + oTime + "' and bzType=0 and State>0 and IsSpier=0 group by UsID"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { long Cents = Convert.ToInt64(ds.Tables[0].Rows[i]["WinCents"]); if (Cents > 0 && Cents >= iPrice) { int usid = Convert.ToInt32(ds.Tables[0].Rows[i]["UsID"]); long cent = Convert.ToInt64(Cents * (iTar * 0.001)); new BCW.BLL.User().UpdateiGold(usid, cent, "跑马返赢"); //发内线 string strLog = "根据你上期跑马排行榜上的赢利情况,系统自动返还了" + cent + "" + ub.Get("SiteBz") + "[url=/bbs/game/horse.aspx]进入跑马[/url]"; new BCW.BLL.Guest().Add(0, usid, new BCW.BLL.User().GetUsName(usid), strLog); } } Utils.Success("返赢操作", "返赢操作成功", Utils.getUrl("horse.aspx"), "1"); } else { DataSet ds = new BCW.BLL.Game.Horsepay().GetList("UsID,sum(WinCent-BuyCent) as WinCents", "AddTime>='" + sTime + "'and AddTime<'" + oTime + "' and bzType=0 and State>0 and IsSpier=0 group by UsID"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { long Cents = Convert.ToInt64(ds.Tables[0].Rows[i]["WinCents"]); if (Cents < 0 && Cents < (-iPrice)) { int usid = Convert.ToInt32(ds.Tables[0].Rows[i]["UsID"]); long cent = Convert.ToInt64((-Cents) * (iTar * 0.001)); new BCW.BLL.User().UpdateiGold(usid, cent, "跑马返负"); //发内线 string strLog = "根据你上期跑马排行榜上的亏损情况,系统自动返还了" + cent + "" + ub.Get("SiteBz") + "[url=/bbs/game/horse.aspx]进入跑马[/url]"; new BCW.BLL.Guest().Add(0, usid, new BCW.BLL.User().GetUsName(usid), strLog); } } Utils.Success("返负操作", "返负操作成功", Utils.getUrl("horse.aspx"), "1"); } }
private void StatPage() { Master.Title = "赢利分析"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("赢利分析(不计机器人)"); builder.Append(Out.Tab("</div>", "<br />")); //今天本金与赢利 long TodayBuyCent = new BCW.BLL.Game.Horsepay().GetSumBuyCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + DateTime.Now.Year + " AND Month(AddTime) = " + DateTime.Now.Month + " and Day(AddTime) = " + DateTime.Now.Day + ""); long TodayWinCent = new BCW.BLL.Game.Horsepay().GetSumWinCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + DateTime.Now.Year + " AND Month(AddTime) = " + DateTime.Now.Month + " and Day(AddTime) = " + DateTime.Now.Day + ""); //昨天本金与赢利 long YesBuyCent = new BCW.BLL.Game.Horsepay().GetSumBuyCent("BzType=0 and State>0 and IsSpier=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 YesWinCent = new BCW.BLL.Game.Horsepay().GetSumWinCent("BzType=0 and State>0 and IsSpier=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 MonthBuyCent = new BCW.BLL.Game.Horsepay().GetSumBuyCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + (DateTime.Now.Year) + " AND Month(AddTime) = " + (DateTime.Now.Month) + " "); long MonthWinCent = new BCW.BLL.Game.Horsepay().GetSumWinCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + (DateTime.Now.Year) + " AND Month(AddTime) = " + (DateTime.Now.Month) + " "); //上月本金与赢利 long Month2BuyCent = new BCW.BLL.Game.Horsepay().GetSumBuyCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + (DateTime.Now.Year - DateTime.Now.Day) + " AND Month(AddTime) = " + (DateTime.Now.Month - DateTime.Now.Day) + " "); long Month2WinCent = new BCW.BLL.Game.Horsepay().GetSumWinCent("BzType=0 and State>0 and IsSpier=0 and Year(AddTime) = " + (DateTime.Now.Year - DateTime.Now.Day) + " AND Month(AddTime) = " + (DateTime.Now.Month - DateTime.Now.Day) + " "); //总本金与赢利 long BuyCent = new BCW.BLL.Game.Horsepay().GetSumBuyCent("BzType=0 and State>0 and IsSpier=0"); long WinCent = new BCW.BLL.Game.Horsepay().GetSumWinCent("BzType=0 and State>0 and IsSpier=0"); builder.Append(Out.Tab("<div>", "")); builder.Append("今天下注:" + TodayBuyCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("今天返彩:" + TodayWinCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("今天净赢:" + (TodayBuyCent - TodayWinCent) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("昨天下注:" + YesBuyCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("昨天返彩:" + YesWinCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("昨天净赢:" + (YesBuyCent - YesWinCent) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("本月下注:" + MonthBuyCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("本月返彩:" + MonthWinCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("本月净赢:" + (MonthBuyCent - MonthWinCent) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("上月下注:" + Month2BuyCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("上月返彩:" + Month2WinCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("上月净赢:" + (Month2BuyCent - Month2WinCent) + "" + ub.Get("SiteBz") + ""); builder.Append(Out.Tab("</div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("总计下注:" + BuyCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("总计返彩:" + WinCent + "" + ub.Get("SiteBz") + "<br />"); builder.Append("总计净赢:" + (BuyCent - WinCent) + "" + 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("horse.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 />")); }
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.Horselist model = new BCW.BLL.Game.Horselist().GetHorselist(id); if (model == null) { Utils.Error("不存在的记录", ""); } Master.Title = "第" + id + "局跑马"; builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("查看下注/开奖记录"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("查看:"); if (ptype == 1) { builder.Append("下注|"); } else { builder.Append("<a href=\"" + Utils.getUrl("horse.aspx?act=view&ptype=1&id=" + id + "&backurl=" + Utils.getPage(0) + "") + "\">下注</a>|"); } if (ptype == 2) { builder.Append("中奖"); } else { builder.Append("<a href=\"" + Utils.getUrl("horse.aspx?act=view&ptype=2&id=" + id + "&backurl=" + Utils.getPage(0) + "") + "\">中奖</a>"); } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = string.Empty; if (ptype == 1) { strWhere += "HorseId=" + id + ""; } else { strWhere += "HorseId=" + id + " and state>0 and winCent>0"; } string[] pageValUrl = { "act", "id", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } // 开始读取列表 IList <BCW.Model.Game.Horsepay> listHorsepay = new BCW.BLL.Game.Horsepay().GetHorsepays(pageIndex, pageSize, strWhere, out recordCount); if (listHorsepay.Count > 0) { builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("第" + id + "局开出:<b>" + Utils.ConvertSeparated(model.WinNum.ToString(), 1, ",") + "</b>"); if (ptype == 1) { builder.Append("<br />共" + recordCount + "注下注"); } else { builder.Append("<br />共" + recordCount + "注中奖"); } builder.Append(Out.Tab("</div>", "<br />")); int k = 1; foreach (BCW.Model.Game.Horsepay n in listHorsepay) { 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 />")); } } builder.Append("" + ((pageIndex - 1) * pageSize + k) + ".<a href=\"" + Utils.getUrl("../uinfo.aspx?uid=" + n.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + n.UsName + "</a>"); string sText = "押[" + Utils.ConvertSeparated(n.Types.ToString(), 1, "-") + "]"; string bzTypes = string.Empty; if (n.bzType == 0) { bzTypes = ub.Get("SiteBz"); } else { bzTypes = ub.Get("SiteBz2"); } if (n.State == 0) { builder.Append(sText + ",共" + n.BuyCent + "" + bzTypes + "[" + DT.FormatDate(n.AddTime, 13) + "]"); } else if (n.State == 1) { builder.Append(sText + ",共" + n.BuyCent + "" + bzTypes + "[" + DT.FormatDate(n.AddTime, 1) + "]"); if (n.WinCent > 0) { builder.Append("赢" + n.WinCent + "" + bzTypes + ""); } } else { builder.Append(sText + ",共" + n.BuyCent + "" + bzTypes + ",赢" + n.WinCent + "" + bzTypes + "[" + DT.FormatDate(n.AddTime, 1) + "]"); } k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("第" + id + "局开出:<b>" + Utils.ConvertSeparated(model.WinNum.ToString(), 1, ",") + "</b>"); builder.Append("<br />共0注中奖"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getPage("horse.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 TopPage() { string strTitle = "跑马排行榜"; Master.Title = strTitle; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append(strTitle); builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = string.Empty; strWhere += "bzType=0 and State>0"; string[] pageValUrl = { "act", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } // 开始读取列表 IList <BCW.Model.Game.Horsepay> listHorsepay = new BCW.BLL.Game.Horsepay().GetHorsepaysTop(pageIndex, pageSize, strWhere, out recordCount); if (listHorsepay.Count > 0) { int k = 1; foreach (BCW.Model.Game.Horsepay n in listHorsepay) { 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 />")); } } builder.Append("[第" + ((pageIndex - 1) * pageSize + k) + "名]<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx?uid=" + n.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + BCW.User.Users.SetUser(n.UsID) + "</a>赢" + n.WinCent + "" + ub.Get("SiteBz") + ""); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getPage("horse.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 />")); }
/// <summary> /// 跑马自动游戏程序 /// </summary> /// <param name="HorseId">局数ID</param> /// <param name="dt">截止时间</param> private void ChangePalyHorse() { BCW.Model.Game.Horselist horse = null; new BCW.User.Game.Horse().HorsePage(); horse = new BCW.BLL.Game.Horselist().GetHorselist(); int HorseId = horse.ID; long Sec = DT.DateDiff(horse.EndTime, DateTime.Now, 4); if (HorseId > 0) { int UsIDNum = new BCW.BLL.Game.Horsepay().GetCount(HorseId);//当期下注ID数 //如果小于15个则自在不同秒数中自动出动1个ID来下注 if (UsIDNum < 5) { bool IsPlay = false; Sec = 480 - Sec; int ZD = 0; if (Sec > 5 && Sec <= 30 && Utils.ParseInt(ub.GetSub("HorseZD1", xmlPath)) == 0) { IsPlay = true; ZD = 1; } if (Sec > 30 && Sec <= 60 && Utils.ParseInt(ub.GetSub("HorseZD2", xmlPath)) == 0) { IsPlay = true; ZD = 2; } else if (Sec > 60 && Sec <= 90 && Utils.ParseInt(ub.GetSub("HorseZD3", xmlPath)) == 0) { IsPlay = true; ZD = 3; } else if (Sec > 90 && Sec <= 120 && Utils.ParseInt(ub.GetSub("HorseZD4", xmlPath)) == 0) { IsPlay = true; ZD = 4; } else if (Sec > 120 && Sec <= 150 && Utils.ParseInt(ub.GetSub("HorseZD5", xmlPath)) == 0) { IsPlay = true; ZD = 5; } else if (Sec > 150 && Sec <= 180 && Utils.ParseInt(ub.GetSub("HorseZD6", xmlPath)) == 0) { IsPlay = true; ZD = 6; } else if (Sec > 180 && Sec <= 210 && Utils.ParseInt(ub.GetSub("HorseZD7", xmlPath)) == 0) { IsPlay = true; ZD = 7; } else if (Sec > 210 && Sec <= 240 && Utils.ParseInt(ub.GetSub("HorseZD8", xmlPath)) == 0) { IsPlay = true; ZD = 8; } else if (Sec > 240 && Sec <= 270 && Utils.ParseInt(ub.GetSub("HorseZD9", xmlPath)) == 0) { IsPlay = true; ZD = 9; } else if (Sec > 270 && Sec <= 300 && Utils.ParseInt(ub.GetSub("HorseZD10", xmlPath)) == 0) { IsPlay = true; ZD = 10; } else if (Sec > 300 && Sec <= 330 && Utils.ParseInt(ub.GetSub("HorseZD11", xmlPath)) == 0) { IsPlay = true; ZD = 11; } else if (Sec > 330 && Sec <= 360 && Utils.ParseInt(ub.GetSub("HorseZD12", xmlPath)) == 0) { IsPlay = true; ZD = 12; } else if (Sec > 360 && Sec <= 390 && Utils.ParseInt(ub.GetSub("HorseZD13", xmlPath)) == 0) { IsPlay = true; ZD = 13; } else if (Sec > 390 && Sec <= 420 && Utils.ParseInt(ub.GetSub("HorseZD14", xmlPath)) == 0) { IsPlay = true; ZD = 14; } else if (Sec > 420 && Sec <= 450 && Utils.ParseInt(ub.GetSub("HorseZD15", xmlPath)) == 0) { IsPlay = true; ZD = 15; } if (IsPlay) { //更新某分钟已出动过 ub xml = new ub(); xml.ReloadSub(xmlPath); //加载配置 xml.dss["HorseZD" + ZD + ""] = 1; System.IO.File.WriteAllText(HttpContext.Current.Server.MapPath(xmlPath), xml.Post(xml.dss), System.Text.Encoding.UTF8); //进行自动下注 PlayHorse(HorseId); } } } }
private void PlayHorse(int HorseId) { int meid = GetUsID(); ChanageOnline(meid); int ptype = GetPtype(); long paycent = GetPayCent(); int bzType = 0;//new Random().Next(0, 2) if (bzType == 1) { paycent = paycent * 5; } 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; if (bzType == 0) { modelx.AcGold = 500000; modelx.AfterGold = gold + 500000;//更新后的币数 } else { modelx.AcGold = 5000000; modelx.AfterGold = gold + 5000000;//更新后的币数 } 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+5000000 where id=" + meid + ""); } } BCW.Model.Game.Horselist horse = new BCW.BLL.Game.Horselist().GetHorselist(); if (horse.ID == HorseId) { //加总押注额 if (bzType == 0) { new BCW.BLL.Game.Horselist().UpdatePool(horse.ID, paycent); new BCW.BLL.User().UpdateiGold(meid, mename, -paycent, "跑马押注"); } else { new BCW.BLL.Game.Horselist().UpdateWinPool(horse.ID, paycent); new BCW.BLL.User().UpdateiMoney(meid, mename, -paycent, "跑马押注"); } BCW.Model.Game.Horsepay model = new BCW.Model.Game.Horsepay(); model.HorseId = horse.ID; model.UsID = meid; model.UsName = mename; model.Types = ptype; model.BuyCent = paycent; model.WinCent = 0; model.AddTime = DateTime.Now; model.State = 0; model.bzType = bzType; if (!new BCW.BLL.Game.Horsepay().Exists(horse.ID, meid, bzType, ptype)) { int pid = new BCW.BLL.Game.Horsepay().Add(model); BCW.Data.SqlHelper.ExecuteSql("Update tb_Horsepay set IsSpier=1 where id=" + pid + "");//机器人标识 } else { new BCW.BLL.Game.Horsepay().Update(model); } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/horse.aspx]跑马第" + horse.ID + "局[/url]押注" + paycent + "" + bzText + ""; new BCW.BLL.Action().Add(10, 0, 0, "", wText); } }