private void ChangeInfoPage() { Master.Title = "兑换礼品"; #region 判断登陆状态 int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } #endregion #region 兑换类型判断 int p = int.Parse(Utils.GetRequest("p", "all", 2, @"^[1-9]\d*$", "兑换类型错误")); if (p > 18) { Utils.Error("兑换类型错误", ""); } if (p == 8) { Utils.Error("兑换类型错误", ""); } builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("您的物品总量:" + new BCW.BLL.Game.GiftFlows().GetTotal(meid) + "/剩余:" + new BCW.BLL.Game.GiftFlows().GetTotall(meid) + "个"); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=me") + "\">>>详细</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"title\">", "")); #endregion #region 判断数量 bool Isbl = true; if (p == 1 || p == 2 || p == 3) { int num = 0; if (p == 1) { builder.Append("您选择兑换:3个x33种共99个物品=8000" + ub.Get("SiteBz") + ""); num = 3; } else if (p == 2) { builder.Append("您选择兑换:2个x33种共66个物品=3000" + ub.Get("SiteBz") + ""); num = 2; } else { builder.Append("您选择兑换:1个x33种共33个物品=300" + ub.Get("SiteBz") + ""); num = 1; } //判断是否有33个不同物品 for (int i = 1; i <= 33; i++) { if (!new BCW.BLL.Game.GiftFlows().Exists(i, meid, num)) { Isbl = false; break; } } } else if (p == 4) { builder.Append("您选择兑换:不同物品32个物品=300" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 32) { Isbl = false; } } else if (p == 5) { builder.Append("您选择兑换:不同物品30个物品=200" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 30) { Isbl = false; } } else if (p == 6) { builder.Append("您选择兑换:不同物品25个物品=200" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 25) { Isbl = false; } } else if (p == 7) { builder.Append("您选择兑换:不同物品20个物品=80" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 20) { Isbl = false; } } else if (p == 8) { builder.Append("您选择兑换:不同物品15个物品=商城礼物1个"); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 15) { Isbl = false; } } else if (p == 9) { builder.Append("您选择兑换:不同物品10个物品=1000" + ub.Get("SiteBz2") + ""); if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 10) { Isbl = false; } } else if (p == 10) { builder.Append("您选择兑换:物品总数5000个=8000" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 5000) { Isbl = false; } } else if (p == 11) { builder.Append("您选择兑换:物品总数3000个=5000" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 3000) { Isbl = false; } } else if (p == 12) { builder.Append("您选择兑换:物品总数2000个=二个月VIP"); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 2000) { Isbl = false; } } else if (p == 13) { builder.Append("您选择兑换:物品总数1500个=一个月VIP"); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 1500) { Isbl = false; } } else if (p == 14) { builder.Append("您选择兑换:物品总数1200个=1500" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 1200) { Isbl = false; } } else if (p == 15) { builder.Append("您选择兑换:物品总数1000个=1200" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 1000) { Isbl = false; } } else if (p == 16) { builder.Append("您选择兑换:物品总数800个=300" + ub.Get("SiteBz") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 800) { Isbl = false; } } else if (p == 17) { builder.Append("您选择兑换:物品总数500个=2000" + ub.Get("SiteBz2") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 500) { Isbl = false; } } else if (p == 18) { builder.Append("您选择兑换:物品总数300个=1000" + ub.Get("SiteBz2") + ""); if (new BCW.BLL.Game.GiftFlows().GetTotall(meid) < 300) { Isbl = false; } } #endregion builder.Append(Out.Tab("</div>", Out.Hr())); string info = Utils.GetRequest("info", "all", 1, "", ""); if (info != "ok") { #region 确认兑换 if (!Isbl) { builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("很遗憾,您的物品量还没有达到兑换所需的条件"); builder.Append(Out.Tab("</div>", "")); } else { builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("恭喜,您的物品量已达到兑换所需的条件"); builder.Append(Out.Tab("</div>", "")); //if (p == 1 || p == 2 || p == 10 | p == 11) //{ // string strText = "填写充值到的手机号:/,再次输入手机号;/,,,"; // string strName = "Notes,Notes2,p,act,info"; // string strType = "text,text,hidden,hidden,hidden"; // string strValu = "''" + p + "'changeinfo'ok"; // string strEmpt = "false,false,false,false,false"; // string strIdea = "/"; // string strOthe = "申请兑换,flows.aspx,post,1,red"; // builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); //} //else //{ builder.Append(Out.Tab("", "<br />")); string strName = "p,act,info"; string strValu = "" + p + "'changeinfo'ok"; string strOthe = "确认兑换,flows.aspx,post,0,red"; builder.Append(Out.wapform(strName, strValu, strOthe)); //} } #endregion } else { #region 兑换过程 if (!Isbl) { Utils.Error("很遗憾,您的物品量还没有达到兑换所需的条件", ""); } #region 变量 string mename = new BCW.BLL.User().GetUsName(meid); string Notes = string.Empty; int State = 1; //if (p == 1 || p == 2 || p == 10 || p == 11) //{ // Notes = Utils.GetRequest("Notes", "post", 2, @"^(?:13|14|15|18)\d{9}$", "请正确输入手机号"); // string Notes2 = Utils.GetRequest("Notes2", "post", 2, @"^(?:13|14|15|18)\d{9}$", "请正确输入手机号"); // if (Notes != Notes2) // { // Utils.Error("您的手机号输入不一致,请重新输入", ""); // } // State = 0; //} #endregion #region 前三种兑换 33个物品一起减去相应数量 if (p == 1 || p == 2 || p == 3) { int num = 0; if (p == 1) { num = 3; } else if (p == 2) { num = 2; } else { num = 1; } //33个物品一起减去相应数量 for (int i = 1; i <= 33; i++) { new BCW.BLL.Game.GiftFlows().UpdateTotall(i, meid, -num); } if (p == 1) { ///30000酷币改8000 new BCW.BLL.User().UpdateiGold(meid, mename, 8000, "兑换物品获得"); } if (p == 2) { ///20000酷币改3000 new BCW.BLL.User().UpdateiGold(meid, mename, 3000, "兑换物品获得"); } if (p == 3) { ///800酷币改300 new BCW.BLL.User().UpdateiGold(meid, mename, 300, "兑换物品获得"); } } #endregion #region 4-9种兑换处理 else if (p >= 4 && p <= 9) { int num = 0; if (p == 4) { ///800酷币改300 new BCW.BLL.User().UpdateiGold(meid, mename, 300, "兑换物品获得"); num = 32; } else if (p == 5) { ///600酷币改200 new BCW.BLL.User().UpdateiGold(meid, mename, 200, "兑换物品获得"); num = 30; } else if (p == 6) { ///500酷币改200 new BCW.BLL.User().UpdateiGold(meid, mename, 200, "兑换物品获得"); num = 25; } else if (p == 7) { ///100酷币改80 new BCW.BLL.User().UpdateiGold(meid, mename, 80, "兑换物品获得"); num = 20; } else if (p == 8) { //商城礼品一个 num = 15; } else { //1000爆谷 new BCW.BLL.User().UpdateiMoney(meid, mename, 1000, "兑换物品获得"); num = 10; } int k = 0; for (int i = 1; i <= 33; i++) { int rac = new BCW.BLL.Game.GiftFlows().UpdateTotall(i, meid, -1); if (rac > 0) { k++; } if (k == num) { break; } } } #endregion #region 10-18兑换处理 else { int num = 0; if (p == 10) { ///50000酷币8000 new BCW.BLL.User().UpdateiGold(meid, mename, 8000, "兑换物品获得"); num = 5000; } else if (p == 11) { ///30000酷币改5000 new BCW.BLL.User().UpdateiGold(meid, mename, 5000, "兑换物品获得"); num = 3000; } else if (p == 12) { //VIP二个月 num = 2000; } else if (p == 13) { //VIP一个月 num = 1500; } else if (p == 14) { ///2000酷币改1500 new BCW.BLL.User().UpdateiGold(meid, mename, 1500, "兑换物品获得"); num = 1200; } else if (p == 15) { ///1000酷币改1200 new BCW.BLL.User().UpdateiGold(meid, mename, 1200, "兑换物品获得"); num = 1000; } else if (p == 16) { ///800酷币改300 new BCW.BLL.User().UpdateiGold(meid, mename, 300, "兑换物品获得"); num = 800; } else if (p == 17) { ///10000爆谷改2000 new BCW.BLL.User().UpdateiMoney(meid, mename, 2000, "兑换物品获得"); num = 500; } else { ///6000爆谷改1000 new BCW.BLL.User().UpdateiMoney(meid, mename, 1000, "兑换物品获得"); num = 300; } if (p == 12 || p == 13)//兑换VIP { BCW.Model.User vipmodel = new BCW.BLL.User().GetVipData(meid); int Grow = 0; int Day = 0; if (p == 12) { Grow = 8; Day = 60; } else { Grow = 8; Day = 30; } if (vipmodel.VipDate != null && vipmodel.VipDate > DateTime.Now) { new BCW.BLL.User().UpdateVipData(meid, Grow, vipmodel.VipDate.AddDays(Day)); } else { new BCW.BLL.User().UpdateVipData(meid, Grow, DateTime.Now.AddDays(Day)); } //清缓存 string CacheKey = CacheName.App_UserVip(meid); DataCache.RemoveByPattern(CacheKey); } DataSet ds = BCW.Data.SqlHelper.Query("SELECT ID, Totall FROM tb_GiftFlows Where UsID=" + meid + " and Totall>0 ORDER by ID ASC"); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { int ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()); int getTotal = int.Parse(ds.Tables[0].Rows[i]["Totall"].ToString()); if (getTotal <= num) { new BCW.BLL.Game.GiftFlows().UpdateTotall(ID, -getTotal); } else { new BCW.BLL.Game.GiftFlows().UpdateTotall(ID, -num); } num = num - getTotal; if (num <= 0) { break; } } } } #endregion #region 写入兑换记录 //写入兑换记录 BCW.Model.Game.GiftChange model = new BCW.Model.Game.GiftChange(); model.UsID = meid; model.UsName = mename; model.Types = p; model.State = State; model.Notes = Notes; model.AddTime = DateTime.Now; new BCW.BLL.Game.GiftChange().Add(model); //if (p == 1 || p == 2 || p == 10 || p == 11) //{ // //通知客服10086 // new BCW.BLL.Guest().Add(10086, "客服", "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "(" + meid + ")[/url]兑换了周年拾物活动-话费卡,请在后台进行处理"); // Utils.Success("兑换礼品", "恭喜,兑换成功,礼品属于话费卡,请留意系统给您的完成充值的内线通知<br /><a href=\"" + Utils.getUrl("flows.aspx?act=change") + "\">>>继续兑换礼品</a>", Utils.getUrl("flows.aspx"), "3"); //} //else //{ Utils.Success("兑换礼品", "恭喜,兑换成功!<br /><a href=\"" + Utils.getUrl("flows.aspx?act=change") + "\">>>继续兑换礼品</a>", Utils.getUrl("flows.aspx"), "3"); //} #endregion #endregion } builder.Append(Out.Tab("<div class=\"text\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=change") + "\">>>重新选择兑换</a>"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", "<br />")); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx") + "\">空间</a>"); builder.Append(Out.Tab("</div>", "")); }
private void ChangeGiftPage() { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } if (new BCW.BLL.Game.GiftFlows().GetTypesTotal(meid) < 15)//15 { Utils.Error("很遗憾,您的物品量还没有达到兑换所需的条件", ""); } int NodeId = 27; string info = Utils.GetRequest("info", "get", 1, "", ""); if (info == "ok") { int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误")); BCW.Model.Shopgift model = new BCW.BLL.Shopgift().GetShopgift(id); int num = 1; if (model == null) { Utils.Error("不存在的商品记录", ""); } if (model.NodeId != NodeId) { Utils.Error("不存在的记录", ""); } if (model.Total != -1 && model.Total < num) { Utils.Error("商品库存不足", ""); } //得到昵称 string mename = new BCW.BLL.User().GetUsName(meid); BCW.Model.Shopkeep keep = new BCW.Model.Shopkeep(); keep.GiftId = id; keep.Title = model.Title.Trim(); keep.Pic = model.Pic; keep.PrevPic = model.PrevPic; keep.Notes = model.Notes; keep.IsSex = model.IsSex; keep.Para = model.Para; keep.UsID = meid; keep.UsName = mename; keep.Total = num; keep.TopTotal = num; keep.AddTime = DateTime.Now; //邵广林 20161128 增加27为空的字段 keep.MerBillNo = ""; keep.NodeId = NodeId; keep.GatewayType = ""; keep.Attach = ""; keep.GoodsName = ""; keep.IsCredit = ""; keep.BankCode = ""; keep.ProductType = ""; if (!new BCW.BLL.Shopkeep().Exists(id, meid)) { new BCW.BLL.Shopkeep().Add(keep); } else { new BCW.BLL.Shopkeep().Update(keep); } //购买库存与出售数量 int num2 = -num; if (model.Total == -1) { num2 = 0; } new BCW.BLL.Shopgift().Update(id, num, num2); //更新此分类出售数量 new BCW.BLL.Shoplist().Update(id, num); //扣活动礼物 int k = 0; for (int i = 1; i <= 33; i++) { int rac = new BCW.BLL.Game.GiftFlows().UpdateTotall(i, meid, -1); if (rac > 0) { k++; } if (k == 15) { break; } } //写入兑换记录 BCW.Model.Game.GiftChange change = new BCW.Model.Game.GiftChange(); change.UsID = meid; change.UsName = mename; change.Types = 8; change.State = 1; change.Notes = "兑换了" + model.Title.Trim() + ""; change.AddTime = DateTime.Now; new BCW.BLL.Game.GiftChange().Add(change); string wText = "在[url=/bbs/game/flows.aspx]活动礼品[/url]兑换了[url=/bbs/bbsshop.aspx?act=giftview&id=" + id + "]" + model.Title.Trim() + "[img]" + model.PrevPic + "[/img][/url]"; new BCW.BLL.Action().Add(12, id, meid, mename, wText); Utils.Success("兑换商城礼物", "兑换商城礼物成功<br /><a href=\"" + Utils.getUrl("/bbs/bbsshop.aspx?act=store") + "\">>我的储物箱</a>", Utils.getUrl("flows.aspx"), "3"); } Master.Title = "活动礼品"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("bbsshop.aspx") + "\">商城</a>>活动礼品"); builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; string strWhere = string.Empty; string strOrder = string.Empty; int pageSize = 5; string[] pageValUrl = { "act", "ptype", "backurl" }; pageIndex = Utils.ParseInt(Request["page"]); if (pageIndex == 0) { pageIndex = 1; } strWhere = "NodeId=" + NodeId + ""; strOrder = "ID DESC"; // 开始读取专题 IList <BCW.Model.Shopgift> listShopgift = new BCW.BLL.Shopgift().GetShopgifts(pageIndex, pageSize, strWhere, strOrder, out recordCount); if (listShopgift.Count > 0) { int k = 1; foreach (BCW.Model.Shopgift n in listShopgift) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } builder.Append("<img src=\"" + n.Pic + "\" alt=\"load\"/>"); builder.Append("<br /><a href=\"" + Utils.getUrl("/bbs/bbsshop.aspx?act=giftview&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + n.Title + "</a>"); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=changegift&info=ok&&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[兑换]</a>"); builder.Append("<br />" + OutMei(n.Para)); //builder.Append(" 售价:" + n.Price + ""); if (n.BzType == 0) { builder.Append(ub.Get("SiteBz")); } else { builder.Append(ub.Get("SiteBz2")); } k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div class=\"text\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=change") + "\">>>重新选择兑换</a>"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", "<br />")); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx") + "\">空间</a>"); builder.Append(Out.Tab("</div>", "")); }
private void TopPage(string act) { Master.Title = "排行榜"; int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[1-2]$", "1")); int id = int.Parse(Utils.GetRequest("id", "get", 1, @"^[1-9]\d*$", "0")); int uid = int.Parse(Utils.GetRequest("uid", "all", 1, @"^[1-9]\d*$", "0")); if (act == "me") { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } uid = meid; ptype = 2; Master.Title = "我的物品"; } builder.Append(Out.Tab("<div>", "")); if (uid == 0) { if (ptype == 1) { builder.Append("总量榜|"); } else { builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=top&ptype=1") + "\">总量榜</a>|"); } if (ptype == 2) { builder.Append("分类榜"); } else { builder.Append("<a href=\"" + Utils.getUrl("flows.aspx?act=top&ptype=2") + "\">分类榜</a>"); } } else { string UsName = new BCW.BLL.User().GetUsName(uid); if (UsName == "") { Utils.Error("不存在的会员", ""); } builder.Append("<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx?uid=" + uid + "&backurl=" + Utils.PostPage(1) + "") + "\">" + UsName + "</a>的物品"); builder.Append("<br />总量:" + new BCW.BLL.Game.GiftFlows().GetTotal(uid) + "/剩余:" + new BCW.BLL.Game.GiftFlows().GetTotall(uid) + "个"); } builder.Append(Out.Tab("</div>", Out.Hr())); int pageIndex; int recordCount; int pageSize = 10; string strWhere = string.Empty; if (id > 0) { strWhere = "Types=" + id + ""; } if (uid > 0) { strWhere = "UsID=" + uid + ""; } string[] pageValUrl = { "act", "id", "uid", "ptype", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } // 开始读取列表 IList <BCW.Model.Game.GiftFlows> listGiftFlows = null; if (ptype == 1) { listGiftFlows = new BCW.BLL.Game.GiftFlows().GetGiftFlowssTop(pageIndex, pageSize, strWhere, out recordCount); } else { listGiftFlows = new BCW.BLL.Game.GiftFlows().GetGiftFlowssTop2(pageIndex, pageSize, strWhere, out recordCount); } if (listGiftFlows.Count > 0) { int k = 1; foreach (BCW.Model.Game.GiftFlows n in listGiftFlows) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } if (ptype == 1) { builder.Append("[第" + ((pageIndex - 1) * pageSize + k) + "名]<a href=\"" + Utils.getUrl("/bbs/uinfo.aspx?uid=" + n.UsID + "") + "\">" + new BCW.BLL.User().GetUsName(n.UsID) + "</a>" + n.Total + "个"); } else { builder.Append("" + ((pageIndex - 1) * pageSize + k) + ".<a href=\"" + Utils.getUrl("flows.aspx?act=top&ptype=1&id=" + n.Types + "") + "\">" + BCW.User.Game.GiftFlows.GetTitleByNum(n.Types) + "</a>共" + n.Total + "个"); if (act == "me") { builder.Append("/剩" + n.Totall + "个"); } } k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div class=\"text\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("flows.aspx") + "\">返回拾物首页</a>"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", "<br />")); 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>", "")); }