/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.Dicepay model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Dicepay model) { dal.Update(model); }
//下注操作 private void PlayDice(int DiceId) { int meid = GetUsID(); ChanageOnline(meid); int ptype = GetPtype(); int bzType = new Random().Next(0, 2); long paycent = GetPayCent(ptype); //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; 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 + ""); } } int BuyNum = GetBuyNum(ptype); //加总押注额 if (bzType == 0) { new BCW.BLL.Game.Dicelist().UpdatePool(DiceId, paycent); new BCW.BLL.User().UpdateiGold(meid, mename, -paycent, "挖宝押注"); } else { new BCW.BLL.Game.Dicelist().UpdateWinPool(DiceId, paycent); new BCW.BLL.User().UpdateiMoney(meid, mename, -paycent, "挖宝押注"); } BCW.Model.Game.Dicepay model = new BCW.Model.Game.Dicepay(); model.DiceId = DiceId; model.UsID = meid; model.UsName = mename; model.Types = ptype; model.BuyNum = BuyNum; model.BuyCent = paycent; model.BuyCount = 1; model.WinCent = 0; model.AddTime = DateTime.Now; model.State = 0; model.bzType = bzType; if (!new BCW.BLL.Game.Dicepay().Exists(DiceId, meid, bzType, ptype, BuyNum)) { int pid = new BCW.BLL.Game.Dicepay().Add(model); BCW.Data.SqlHelper.ExecuteSql("Update tb_Dicepay set IsSpier=1 where id=" + pid + "");//机器人标识 } else { new BCW.BLL.Game.Dicepay().Update(model); } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/dice.aspx]挖宝第" + DiceId + "局[/url]押注" + paycent + "" + bzText + ""; new BCW.BLL.Action().Add(9, 0, 0, "", wText); }