/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.Horsepay model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Horsepay model) { dal.Update(model); }
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); } }