Пример #1
0
    //删除页面
    private void DelHb()
    {
        string info = Utils.GetRequest("info", "all", 1, "", "");
        int    id   = int.Parse(Utils.GetRequest("hbid", "get", 2, @"^[1-9]\d*$", "ID错误"));

        if (info == "")
        {
            Master.Title = "删除红包";
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("确定删除该红包吗");
            builder.Append(Out.Tab("</div>", "<br />"));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append("<a href=\"" + Utils.getUrl("chat.aspx?info=ok&amp;act=delhb&amp;hbid=" + id) + "\">确定删除</a><br />");
            builder.Append("<a href=\"" + Utils.getUrl("chat.aspx?act=hb&amp;ptyge=0") + "\">先留着吧..</a>");
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            if (!new BCW.HB.BLL.HbPost().Exists(id))
            {
                Utils.Error("不存在的记录", "");
            }
            BCW.HB.Model.HbPost           modell = new BCW.HB.BLL.HbPost().GetModel(id);
            List <BCW.HB.Model.HbGetNote> hbnote = new BCW.HB.BLL.HbGetNote().GetModelList("HbID=" + id);
            long symoney = 0;
            for (int iso = 0; iso < hbnote.Count; iso++)
            {
                new BCW.HB.BLL.HbGetNote().Delete(hbnote[iso].ID);
                symoney = symoney + hbnote[iso].GetMoney;
            }
            new BCW.HB.BLL.HbPost().Delete(id);
            string postname = new BCW.BLL.User().GetUsName(modell.UserID);
            new BCW.BLL.User().UpdateiGold(modell.UserID, symoney, "错误红包返还");
            new BCW.BLL.Guest().Add(1, modell.UserID, postname, "您的错误红包剩余酷币已返还,获得了" + symoney + "酷币。");
            Utils.Success("删除红包", "删除成功..", Utils.getPage("chat.aspx?act=hb"), "1");
        }
    }
Пример #2
0
    //红包功能管理
    private void HbPage()
    {
        Master.Title = "红包功能管理";
        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("红包功能管理");
        builder.Append(Out.Tab("</div>", "<br/>"));
        int    ptyge  = int.Parse(Utils.GetRequest("ptyge", "all", 1, @"^[0-9]$", "1"));
        string userid = Utils.GetRequest("userid", "all", 1, @"^\d*$", "");
        string hbid   = Utils.GetRequest("hbid", "all", 1, @"^\d*$", "");

        if (ptyge == 0)
        {
            builder.Append(Out.Tab("<div class=\"text\">", ""));
            builder.Append("<a href=\"" + Utils.getUrl("chat.aspx?act=hb") + "\">红包设置</a>|");
            builder.Append("红包查看");
            builder.Append(Out.Tab("</div>", "<br/>"));
        }
        else
        {
            builder.Append(Out.Tab("<div class=\"text\">", ""));
            builder.Append("红包设置|");
            builder.Append("<a href=\"" + Utils.getUrl("chat.aspx?act=hb&amp;ptyge=0") + "\">红包查看</a>");
            builder.Append(Out.Tab("</div>", "<br/>"));
        }
        int    pageIndex;
        int    recordCount;
        int    pageSize = 5;
        string strWhere = "";

        string[] pageValUrl = { "ptyge", "act", "userid", "hbid", "backurl" };
        if (userid != "")
        {
            strWhere = "UserID=" + userid;
        }
        if (hbid != "" && userid == "")
        {
            strWhere = "ID=" + hbid;
        }
        if (ptyge == 0)
        {
            pageIndex = Utils.ParseInt(Request.QueryString["page"]);
            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            IList <BCW.HB.Model.HbPost> listHbGet = new BCW.HB.BLL.HbPost().GetListByPage(pageIndex, pageSize, strWhere, out recordCount);
            if (listHbGet.Count > 0)
            {
                int k = 1;
                foreach (BCW.HB.Model.HbPost n in listHbGet)
                {
                    if (k % 2 == 0)
                    {
                        builder.Append(Out.Tab("<div class=\"text\">", Out.Hr()));
                    }
                    else
                    {
                        if (k == 1)
                        {
                            builder.Append(Out.Tab("<div>", "<br />"));
                        }
                        else
                        {
                            builder.Append(Out.Tab("<div>", "<br />"));
                        }
                    }
                    string name = new BCW.BLL.User().GetUsName(n.UserID);
                    string sbb  = "";
                    if (n.State == 0)
                    {
                        sbb = "待发";
                    }
                    else if (n.State == 2)
                    {
                        sbb = "过期";
                    }
                    else
                    {
                        sbb = "已发";
                    }
                    long   sum    = n.money;
                    string hyni   = "";
                    string biubiu = "";
                    if (n.RadomNum.Trim() == "pt")
                    {
                        sum        = n.money * n.num;
                        n.RadomNum = "普通";
                        hyni       = "普通";
                        biubiu     = n.GetIDList;
                    }
                    else
                    {
                        hyni = "拼手气";
                        if (n.num < 2)
                        {
                            if (n.GetIDList.Trim() != "")
                            {
                                string[] someid = n.GetIDList.Split('#');
                                biubiu = someid[0] + "得" + n.RadomNum + "币";
                            }
                            else
                            {
                                biubiu = n.RadomNum + "币";
                            }
                        }
                        else
                        {
                            string[] kubi   = n.RadomNum.Split('#');
                            string[] someid = n.GetIDList.Split('#');
                            int      j      = 0;
                            for (int i = 0; i < kubi.Length - 1; i++)
                            {
                                if (j < someid.Length - 1)
                                {
                                    biubiu = biubiu + someid[j] + "得" + kubi[i] + "币" + "|";
                                    j++;
                                }
                                else
                                {
                                    biubiu = biubiu + kubi[i] + "币|";
                                }
                            }
                        }
                    }

                    builder.Append("<a href=\"" + Utils.getUrl("chat.aspx?act=delhb&amp;hbid=" + n.ID) + "\">[删]</a>");
                    builder.Append(n.ID + ".<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.UserID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">" + name + "</a>(" + n.UserID + ")" + "的" + hyni + "红包(" + n.ID + ")|总金额" + sum + "|" + n.PostTime + "|[" + sbb + "]|共" + n.num + "个(" + biubiu + ") <br/> ");
                    k++;
                    builder.Append(Out.Tab("</div>", ""));
                }
                // 分页
                builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
            }
            else
            {
                builder.Append(Out.Div("div", "没有相关记录.."));
            }
            string strText = "发红包用户ID:,红包ID:";
            string strName = "userid,hbid";
            string strType = "num,num";
            string strValu = "'";
            string strEmpt = "true,true";
            string strIdea = "/";
            string strOthe = "查询,chat.aspx?act=hb&amp;ptyge=0,post,1,red";
            builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
            builder.Append(Out.Tab("", "<br />"));
        }
        else
        {
            string xmlPath = "/Controls/chathb.xml";
            ub     xml     = new ub();
            string ac      = Utils.GetRequest("ac", "all", 1, "", "");
            Application.Remove(xmlPath); //清缓存
            xml.ReloadSub(xmlPath);      //加载配置
            if (Utils.ToSChinese(ac) == "确定修改")
            {
                string HbOpen      = Utils.GetRequest("hbgn", "post", 2, @"^[0-1]$", "红包功能选择出错");
                string HbNumMax    = Utils.GetRequest("hbnum", "post", 2, @"^[1-9]\d*$", "单次最多红包个数填写错误");
                string HbMoneyMax  = Utils.GetRequest("sqmax", "post", 2, @"^[1-9]\d*$", "手气红包最大金额填写错误");
                string HbMoneyMax2 = Utils.GetRequest("ptmax", "post", 2, @"^[1-9]\d*$", "普通红包最大金额填写错误");
                string HbMoneyMin  = Utils.GetRequest("sqmin", "post", 2, @"^[1-9]\d*$", "手气红包最小金额填写错误");
                string HbMoneyMin2 = Utils.GetRequest("ptmin", "post", 2, @"^[1-9]\d*$", "普通红包最小金额填写错误");
                string HbTime      = Utils.GetRequest("hbtime", "post", 2, @"^[1-9]\d*$", "红包过期时间填写错误");
                string HbSpeed     = Utils.GetRequest("hbspeed", "post", 2, @"^[1-9]\d*$", "红包滚动速度填写错误");
                xml.dss["HbOpen"]      = HbOpen;
                xml.dss["HbNumMax"]    = HbNumMax;
                xml.dss["HbMoneyMax"]  = HbMoneyMax;
                xml.dss["HbMoneyMax2"] = HbMoneyMax2;
                xml.dss["HbMoneyMin"]  = HbMoneyMin;
                xml.dss["HbMoneyMin2"] = HbMoneyMin2;
                xml.dss["HbTime"]      = HbTime;
                xml.dss["HbSpeed"]     = HbSpeed;
                System.IO.File.WriteAllText(Server.MapPath(xmlPath), xml.Post(xml.dss), System.Text.Encoding.UTF8);
                Utils.Success("红包群红包设置", "设置成功,正在返回..", Utils.getUrl("chat.aspx?act=hb"), "1");
            }
            else
            {
                string strText = "红包功能/,单次最多红包个数/,手气红包最小金额/,手气红包最大金额/,普通红包最小金额/,普通红包最大金额/,红包过期时间(天)/,红包滚动速度(越小滚动越快,50为正常速度)/,";
                string strName = "hbgn,hbnum,sqmin,sqmax,ptmin,ptmax,hbtime,hbspeed,backurl";
                string strType = "select,num,num,num,num,num,num,num,hidden";
                string strValu = xml.dss["HbOpen"] + "'" + xml.dss["HbNumMax"] + "'" + xml.dss["HbMoneyMin"] + "'" + xml.dss["HbMoneyMax"] + "'" + xml.dss["HbMoneyMin2"] + "'" + xml.dss["HbMoneyMax2"] + "'" + xml.dss["HbTime"] + "'" + xml.dss["HbSpeed"] + "'" + Utils.getPage(0) + "";
                string strEmpt = "0|开启|1|关闭,false,false,false,false,false,false,false,false";
                string strIdea = "/";
                string strOthe = "确定修改|reset,chat.aspx?act=hb,post,1,red|blue";
                builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
            }
        }
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        builder.Append("<a href=\"" + Utils.getUrl("chat.aspx") + "\">返回红包群管理</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }