/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Ballpay model) { dal.Update(model); }
private void PayOkPage() { if (IsOpen() == false) { Utils.Error("游戏开放时间:" + ub.GetSub("BallOnTime", xmlPath) + "", ""); } int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } int BuyNum = int.Parse(Utils.GetRequest("BuyNum", "post", 2, @"^[1-9]$|^[1-4]([0-9])?$", "下注数字限1-" + ub.GetSub("BallSysNum", xmlPath) + "")); int BuyCount = int.Parse(Utils.GetRequest("BuyCount", "post", 2, @"^[1-9]\d*$", "下注份数填写错误")); if (BuyNum < 1 || BuyNum > Utils.ParseInt(ub.GetSub("BallSysNum", xmlPath))) { Utils.Error("下注数字限1-" + ub.GetSub("BallSysNum", xmlPath) + "", ""); } //是否刷屏 string appName = "LIGHT_BALL"; int Expir = Utils.ParseInt(ub.GetSub("BallExpir", xmlPath)); BCW.User.Users.IsFresh(appName, Expir); BCW.Model.Game.Balllist ball = new BCW.BLL.Game.Balllist().GetBalllist(); //每期每ID限下注份数 int BuyCounts = new BCW.BLL.Game.Ballpay().GetBuyCount(ball.ID, meid); if (BuyCount + BuyCounts > Utils.ParseInt(ub.GetSub("BallOutIDNum", xmlPath))) { if (BuyCounts >= Utils.ParseInt(ub.GetSub("BallOutIDNum", xmlPath))) { Utils.Error("系统限制每期每人下注" + Utils.ParseInt(ub.GetSub("BallOutIDNum", xmlPath)) + "份,欢迎在下期下注", ""); } else { Utils.Error("系统限制每期每人下注" + Utils.ParseInt(ub.GetSub("BallOutIDNum", xmlPath)) + "份,你现在最多可以下注" + (Utils.ParseInt(ub.GetSub("BallOutIDNum", xmlPath)) - BuyCounts) + "份", ""); } } Application.Lock(); //每期下注限份数 if ((ball.OutNum - ball.AddNum) < BuyCount) { if (ball.OutNum == 0) { Utils.Error("系统每期限购" + ball.OutNum + "份,欢迎在下期下注", ""); } else { Utils.Error("系统每期限购" + ball.OutNum + "份,您还可以购买" + ((ball.OutNum - ball.AddNum) - BuyCount) + "份", ""); } } if (Convert.ToInt64(BuyCount * ball.iCent) > new BCW.BLL.User().GetGold(meid)) { Utils.Error("需花费" + Convert.ToInt64(BuyCount * ball.iCent) + "" + ub.Get("SiteBz") + ",你身上" + ub.Get("SiteBz") + "不足", ""); } //支付安全提示 string[] p_pageArr = { "act", "BuyNum", "BuyCount" }; BCW.User.PaySafe.PaySafePage(meid, Utils.getPageUrl(), p_pageArr); BCW.Model.Game.Ballpay model = new BCW.Model.Game.Ballpay(); int id = 0; string mename = new BCW.BLL.User().GetUsName(meid); model.BallId = ball.ID; model.UsID = meid; model.UsName = mename; model.BuyCent = Convert.ToInt64(BuyCount * ball.iCent); model.BuyNum = BuyNum; model.BuyCount = BuyCount; model.State = 0; model.WinCent = 0; model.AddTime = DateTime.Now; if (!new BCW.BLL.Game.Ballpay().ExistsBuyNum(ball.ID, BuyNum, meid)) { id = new BCW.BLL.Game.Ballpay().Add(model); } else { new BCW.BLL.Game.Ballpay().Update(model); } //加奖池基金并减购买份数 new BCW.BLL.Game.Balllist().UpdatePool(ball.ID, Convert.ToInt64(BuyCount * ball.iCent), BuyCount); //扣币 new BCW.BLL.User().UpdateiGold(meid, mename, -Convert.ToInt64(BuyCount * ball.iCent), 6); string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]在[url=/bbs/game/ball.aspx]疯狂彩球第" + ball.ID + "期[/url]下注" + Convert.ToInt64(BuyCount * ball.iCent) + "" + ub.Get("SiteBz") + ""; new BCW.BLL.Action().Add(8, id, 0, "", wText); Utils.Success("下注", "下注成功,花费了" + Convert.ToInt64(BuyCount * ball.iCent) + "" + ub.Get("SiteBz") + "<br /><a href=\"" + Utils.getUrl("ball.aspx?act=pay") + "\">>继续下注</a>", Utils.getUrl("ball.aspx"), "2"); Application.UnLock(); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.Ballpay model) { return(dal.Add(model)); }