/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.GiftFlows model) { dal.Update(model); }
private void ViewPage() { Master.Title = "抢啊~"; if (Utils.GetBrowser() == "Opera" || Utils.GetBrowser() == "Mozilla" || Utils.GetBrowser() == "Firefox" || Utils.GetBrowser() == "IE") { Utils.Error("请使用手机进行拾物", ""); } if (Utils.GetUA().Contains("Mozilla/4.0+") || Utils.GetUA().Contains("Opera") || Utils.GetUA().Contains("Explorer") || Utils.GetUA().Contains("MQQBrowser")) { Utils.Error("请使用手机进行拾物", ""); } if (Utils.GetBrowser() == "IE" && Utils.GetUA().Contains("Mozilla/4.0")) { Utils.Error("请使用手机进行拾物", ""); } if (Utils.GetBrowser() == "Chrome" && Utils.GetUA().Contains("Windows")) { Utils.Error("请使用手机进行拾物", ""); } //string ipCity = new IPSearch().GetAddressWithIP(Utils.GetUsIP()); //if (!string.IsNullOrEmpty(ipCity)) //{ // ipCity = ipCity.Replace("IANA保留地址 CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":"; // if (!ipCity.Contains("移动")) // { // Utils.Error("请使用移动网络进行拾物", ""); // } //} int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } string xmlPath = "/Controls/Flows.xml"; int ptype = int.Parse(Utils.GetRequest("ptype", "get", 2, @"^[1-9]\d*$", "类型错误")); if (ptype > 15) { Utils.Error("类型错误", ""); } ub xml = new ub(); HttpContext.Current.Application.Remove(xmlPath); //清缓存 xml.ReloadSub(xmlPath); //加载配置 DateTime SecTime = Convert.ToDateTime(ub.GetSub("FlowsGfSecTime" + ptype + "", xmlPath)); if (SecTime < DateTime.Now) { //更新下一期抽奖时间(秒) xml.dss["FlowsGfSecTime" + ptype + ""] = DateTime.Now.AddDays(-365).ToString(); try { System.IO.File.WriteAllText(HttpContext.Current.Server.MapPath(xmlPath), xml.Post(xml.dss), System.Text.Encoding.UTF8); } catch { } HttpContext.Current.Application.Remove(xmlPath);//清缓存 builder.Append("到底你还是慢了半拍!物品不是被别人抢走就是溜走咯~~"); builder.Append("<br /><a href=\"" + Utils.getPage("/bbs/default.aspx") + "\">继续去溜达>></a>"); } else { //验证防刷 string verify = Utils.GetRequest("verify", "get", 2, @"^[\s\S]{1,}$", "验证码错误"); verify = DESEncrypt.Decrypt(verify); if (verify == "") { Utils.Error("验证码有误,请点击以下返回", Utils.getPage("/bbs/default.aspx")); } if (!Utils.IsRegex(verify, @"^[0-9]\d*$")) { Utils.Error("验证码有误,请点击以下返回", Utils.getPage("/bbs/default.aspx")); } string meverify = new BCW.BLL.User().GetVerifys(meid); if (!string.IsNullOrEmpty(meverify)) { if (verify.Equals(meverify)) { Utils.Error("验证码有误,请点击以下返回", Utils.getPage("/bbs/default.aspx")); } } //更新验证码 new BCW.BLL.User().UpdateVerifys(meid, verify); string GfTitle = xml.dss["FlowsGfTitle" + ptype + ""].ToString(); string GfImage = xml.dss["FlowsGfImage" + ptype + ""].ToString(); //得到鲜花类型 int FlowsType = BCW.User.Game.GiftFlows.GetNumByTitle(GfTitle); //防止同一会员同一类型多次拾物 if (new BCW.BLL.Game.GiftFlows().ExistsSec(FlowsType, meid, 15)) { Utils.Error("您已获得本轮奖励,请等待下一轮或到别处抢抢吧", Utils.getPage("/bbs/default.aspx")); } string mename = new BCW.BLL.User().GetUsName(meid); BCW.Model.Game.GiftFlows model = new BCW.Model.Game.GiftFlows(); model.Types = FlowsType; model.UsID = meid; model.UsName = mename; model.Total = 1; model.Totall = 1; if (!new BCW.BLL.Game.GiftFlows().Exists(FlowsType, meid)) { new BCW.BLL.Game.GiftFlows().Add(model); } else { new BCW.BLL.Game.GiftFlows().Update(model); } //记录动态 string wText = "获得[url=/bbs/game/flows.aspx]" + GfTitle + "[img]/Files/gift/Flows/" + GfImage + "[/img][/url]"; new BCW.BLL.Action().Add(19, 0, meid, mename, wText); builder.Append("恭喜恭喜~~你获得" + GfTitle + "<img src=\"/Files/gift/Flows/" + GfImage + "\" alt=\"" + GfTitle + "\"/>一个"); builder.Append("<br /><a href=\"" + Utils.getPage("/bbs/default.aspx") + "\">继续去溜达>></a>"); } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx") + "\">进入拾物首页</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=top") + "\">拾物排行榜</a>"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("/bbs/default.aspx") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx") + "\">空间</a>"); builder.Append(Out.Tab("</div>", "")); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.GiftFlows model) { return(dal.Add(model)); }