private void CentPage() { int forumid = int.Parse(Utils.GetRequest("forumid", "all", 2, @"^[0-9]\d*$", "论坛ID错误")); if (!new BCW.BLL.Forum().Exists2(forumid)) { Utils.Success("访问论坛", "该论坛不存在或已暂停使用", Utils.getUrl("forum.aspx"), "1"); } if (new BCW.User.ForumInc().IsForumGSIDS(forumid) == true) { } else { Utils.Error("不存在的记录", ""); } Master.Title = "奖励会员"; int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } string GsAdminID = ub.GetSub("BbsGsAdminID", xmlPath); if (!("#" + GsAdminID + "#").Contains("#" + meid + "#")) { Utils.Error("权限不足", ""); } int bid = int.Parse(Utils.GetRequest("bid", "all", 2, @"^[0-9]\d*$", "ID错误")); if (!new BCW.BLL.Text().Exists2(bid, forumid)) { Utils.Error("帖子不存在或已被删除", ""); } BCW.Model.Text model = new BCW.BLL.Text().GetText(bid); string info = Utils.GetRequest("info", "post", 1, "", ""); if (info != "") { string Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1,50}$", "奖励原因限1-50字内,不能留空"); long Gold = Int64.Parse(Utils.GetRequest("iGold", "post", 1, @"^[0-9]\d*$", "0")); long Money = Int64.Parse(Utils.GetRequest("iMoney", "post", 1, @"^[0-9]\d*$", "0")); long Score = Int64.Parse(Utils.GetRequest("iScore", "post", 1, @"^[0-9]\d*$", "0")); int Vip = int.Parse(Utils.GetRequest("iVip", "post", 1, @"^[0-3]$", "0")); string LogText = "" + Content + ""; if (Gold > 0) { LogText += "/奖" + Gold + "" + ub.Get("SiteBz") + ""; } if (Money > 0) { LogText += "/奖" + Money + "" + ub.Get("SiteBz2") + ""; } if (Score > 0) { LogText += "/奖" + Score + "积分"; } if (Vip > 0) { LogText += "/奖VIP" + Vip + "月"; } if (info == "ok") { builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("奖励对象:<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + model.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + model.UsName + "(" + model.UsID + ")</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("奖励并生成日志:" + LogText + ""); builder.Append(Out.Tab("</div>", "<br />")); string strName = "Content,iGold,iMoney,iScore,iVip,forumid,bid,act,info,backurl"; string strValu = "" + Content + "'" + Gold + "'" + Money + "'" + Score + "'" + Vip + "'" + forumid + "'" + bid + "'cent'ok2'" + Utils.getPage(0) + "'"; string strOthe = "确认奖励,Gstoplist.aspx,post,0,red"; builder.Append(Out.wapform(strName, strValu, strOthe)); } else { if (Gold > 0) { new BCW.BLL.User().UpdateiGold(model.UsID, model.UsName, Gold, Content); } if (Money > 0) { new BCW.BLL.User().UpdateiMoney(model.UsID, model.UsName, Money, Content); } if (Score > 0) { new BCW.BLL.User().UpdateiScore(model.UsID, Score); } if (Vip > 0) { string xmlPathvip = "/Controls/bbs.xml"; int VipGrow1 = Utils.ParseInt(ub.GetSub("VipGrow1", xmlPathvip)); int VipGrow2 = Utils.ParseInt(ub.GetSub("VipGrow2", xmlPathvip)); int VipGrow3 = Utils.ParseInt(ub.GetSub("VipGrow3", xmlPathvip)); int VipGrow4 = Utils.ParseInt(ub.GetSub("VipGrow4", xmlPathvip)); int Grow = 0; int Day = 0; if (Vip == 1) { Grow = VipGrow1; Day = 30; } else if (Vip == 2) { Grow = VipGrow2; Day = 90; } else if (Vip == 3) { Grow = VipGrow3; Day = 180; } BCW.Model.User model2 = new BCW.BLL.User().GetVipData(model.UsID); try { if (model2.VipDate != null && model2.VipDate > DateTime.Now) { new BCW.BLL.User().UpdateVipData(model.UsID, Grow, model2.VipDate.AddDays(Day)); } else { new BCW.BLL.User().UpdateVipData(model.UsID, Grow, DateTime.Now.AddDays(Day)); } } catch { new BCW.BLL.User().UpdateVipData(model.UsID, Grow, DateTime.Now.AddDays(Day)); } //清缓存 string CacheKey = CacheName.App_UserVip(model.UsID); DataCache.RemoveByPattern(CacheKey); } //记录日志 BCW.Model.Forumvotelog m = new BCW.Model.Forumvotelog(); m.UsID = model.UsID; m.UsName = model.UsName; m.AdminId = meid; m.BID = bid; m.ForumId = forumid; m.Title = model.Title; m.Notes = LogText; m.AddTime = DateTime.Now; new BCW.BLL.Forumvotelog().Add(m); Utils.Success("奖励会员", "恭喜,奖励成功,正在返回..", Utils.getPage("Gstoplist.aspx?forumid=" + forumid + ""), "2"); } } else { builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("主题:<a href=\"" + Utils.getUrl("topic.aspx?forumid=" + model.ForumId + "&bid=" + bid + "&backurl=" + Utils.PostPage(1) + "") + "\">" + model.Title + "</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("奖励对象:<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + model.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + model.UsName + "(" + model.UsID + ")</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("Gstoplist.aspx?act=centlist&forumid=" + model.ForumId + "&hid=" + model.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">查看奖励记录>></a>"); builder.Append(Out.Tab("</div>", "")); string strText = "奖励原因(如填写:2013001期5连中):/,奖" + ub.Get("SiteBz") + ":/,奖" + ub.Get("SiteBz2") + ":/,奖积分:/,奖VIP:/,,,,,,"; string strName = "Content,iGold,iMoney,iScore,iVip,forumid,bid,act,info,backurl"; string strType = "textarea,num,num,num,select,hidden,hidden,hidden,hidden,hidden"; string strValu = "''''0'" + forumid + "'" + bid + "'cent'ok'" + Utils.getPage(0) + ""; string strEmpt = "true,true,true,true,0|不赠送|1|1个月|2|3个月|3|6个月,false,false,false,false,false"; string strIdea = "/"; string strOthe = "确定奖励,Gstoplist.aspx,post,1,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div class=\"title\">", "<br />")); builder.Append("<a href=\"" + Utils.getPage("Gstoplist.aspx?forumid=" + forumid + "") + "\"><<返回上级</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("uinfo.aspx?backurl=" + Utils.getPage(0) + "") + "\">上级</a>-"); builder.Append("<a href=\"" + Utils.getUrl("forum.aspx?forumid=" + forumid + "") + "\">论坛</a>"); builder.Append(Out.Tab("</div>", "")); } }
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>", "")); }