/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.Racelist model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Racelist model) { dal.Update(model); }
private void PayPage() { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } int id = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "ID错误")); long payCent = Int64.Parse(Utils.GetRequest("payCent", "post", 4, @"^[1-9]\d*$", "出价错误")); BCW.Model.Game.Race model = new BCW.BLL.Game.Race().GetRace(id); if (model.userid == meid) { Utils.Error("不能竞拍自己的物品", ""); } if (model.paytype != 1) { Utils.Error("此竞拍未通过审核或已结束", ""); } if (model.totime < DateTime.Now) { Utils.Error("竞拍已经结束", ""); } string bzText = string.Empty; if (model.Types == 0) { bzText = ub.Get("SiteBz"); } else { bzText = ub.Get("SiteBz2"); } long payCents = 0; if (model.Types == 0) { payCents = model.topPrice + Utils.ParseInt64(ub.GetSub("RaceZfPrice", xmlPath)); } else { payCents = model.topPrice + Utils.ParseInt64(ub.GetSub("RaceZfPrice2", xmlPath)); } if (payCent < payCents) { Utils.Error("出价至少" + payCents + "" + bzText + "", ""); } long gold = 0; if (model.Types == 0) { gold = new BCW.BLL.User().GetGold(meid); } else { gold = new BCW.BLL.User().GetMoney(meid); } if (gold < Convert.ToInt64(payCent)) { Utils.Error("你的" + bzText + "不足", ""); } if (model.winID == meid) { Utils.Error("你已成功出价", ""); } string mename = new BCW.BLL.User().GetUsName(meid); if (model.Types == 0) { //支付安全提示 string[] p_pageArr = { "act", "id", "payCent" }; BCW.User.PaySafe.PaySafePage(meid, Utils.getPageUrl(), p_pageArr); //扣币 new BCW.BLL.User().UpdateiGold(meid, mename, -payCent, "竞拍物品"); //退回上个会员ID的币 if (model.winID > 0 && model.topPrice > 0) { new BCW.BLL.User().UpdateiGold(model.winID, model.winName, model.topPrice, "竞拍退回"); //发内线提示上一个会员ID new BCW.BLL.Guest().Add(1, model.winID, model.winName, "[URL=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/URL]以" + payCent + "" + bzText + "竞拍[URL=/bbs/game/race.aspx?act=view&id=" + id + "]" + model.title + "[/URL],系统将您之前竞拍的" + model.topPrice + "" + bzText + "退回到您的帐上"); } } else { //扣币 new BCW.BLL.User().UpdateiMoney(meid, mename, -payCent, "竞拍物品"); //退回上个会员ID的币 if (model.winID > 0 && model.topPrice > 0) { new BCW.BLL.User().UpdateiMoney(model.winID, model.winName, model.topPrice, "竞拍退回"); //发内线提示上一个会员ID new BCW.BLL.Guest().Add(1, model.winID, model.winName, "[URL=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/URL]以" + payCent + "" + bzText + "竞拍[URL=/bbs/game/race.aspx?act=view&id=" + id + "]" + model.title + "[/URL],系统将您之前竞拍的" + model.topPrice + "" + bzText + "退回到您的帐上"); } } //写入购买记录 BCW.Model.Game.Racelist paymodel = new BCW.Model.Game.Racelist(); paymodel.payname = mename; paymodel.payusid = meid; paymodel.payCent = payCent; paymodel.paytime = DateTime.Now; paymodel.raceid = id; paymodel.paytype = 0; new BCW.BLL.Game.Racelist().Add(paymodel); //更新最新报价和会员ID new BCW.BLL.Game.Race().UpdatetopPrice(id, payCent, meid, mename, 1); //检查结束时间是否少于5分钟 string sText = string.Empty; DateTime stime = model.totime.AddMinutes(5);//加5分钟 if (DateTime.Now > model.totime.AddMinutes(-5)) { new BCW.BLL.Game.Race().Updatetotime(id, stime); sText = "为公平起见,竞拍结束时间延长5分钟"; } string wText = "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]以" + payCent + "" + bzText + "竞拍[url=/bbs/game/race.aspx?act=view&id=" + id + "]" + model.title + "[/url]"; new BCW.BLL.Action().Add(4, id, 0, "", wText); //活跃抽奖入口_20160621姚志光 try { //表中存在记录 if (new BCW.BLL.tb_WinnersGame().ExistsGameName("欢乐竞拍")) { //投注是否大于设定的限额,是则有抽奖机会 if (payCent > new BCW.BLL.tb_WinnersGame().GetPrice("欢乐竞拍")) { string TextForUbb = (ub.GetSub("TextForUbb", "/Controls/winners.xml")); //设置内线提示的文字 string WinnersGuessOpen = (ub.GetSub("WinnersGuessOpen", "/Controls/winners.xml")); //1发内线2不发内线 int hit = new BCW.winners.winners().CheckActionForAll(1, 1, meid, mename, "竞拍", 3); if (hit == 1) { //内线开关 1开 if (WinnersGuessOpen == "1") { //发内线到该ID new BCW.BLL.Guest().Add(0, meid, mename, TextForUbb); } } } } } catch { } Utils.Success("出价竞拍", "出价成功!" + sText + "", Utils.getUrl("race.aspx?act=view&id=" + id + ""), "1"); }