Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        if (!IsPostBack)
        {
            //导航及产品
            bottomNav.Text = "<a href=\"/\" target=\"_top\">网站首页</a>&nbsp;<span class=\"headLine\">|</span>&nbsp;<a href=\"http://s.click.taobao.com/t_9?p=mm_14288563_0_0&l=http%3A%2F%2Ftemai.tmall.com\" target=\"_blank\">品牌特卖</a>";
            DataTable dt = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid      = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();

                bottomNav.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;<a href=\"/" + tid + ".htm\" target=\"_top\">" + treeName + "</a>";
            }
            dt.Dispose();

            miibeian.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "miibeian");
            webTitle.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName");
            webVer.Text   = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webVer");

            yearLab.Text = DateTime.Now.Year.ToString();

            countStr.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "countScript");

            string qqID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "qq");
            qqLink.Text = xc.QQHTM(qqID, "41");

            string tbID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobao");
            tbLink.Text = xc.taobaoHTM(tbID, "1");

            string tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "freePhone");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text = tel + "&nbsp;";
            }
            tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "mobile");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
            }
            tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webTel");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
            }

            appKey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        if (!IsPostBack)
        {
            //导航及产品
            bottomNav.Text = "<a href=\"/\" target=\"_top\">网站首页</a>&nbsp;<span class=\"headLine\">|</span>&nbsp;<a href=\"http://s.click.taobao.com/t_9?p=mm_14288563_0_0&l=http%3A%2F%2Ftemai.tmall.com\" target=\"_blank\">品牌特卖</a>";
            DataTable dt = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();

                bottomNav.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;<a href=\"/" + tid + ".htm\" target=\"_top\">" + treeName + "</a>";
            }
            dt.Dispose();

            miibeian.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "miibeian");
            webTitle.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName");
            webVer.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webVer");

            yearLab.Text = DateTime.Now.Year.ToString();

            countStr.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "countScript");

            string qqID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "qq");
            qqLink.Text = xc.QQHTM(qqID, "41");

            string tbID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobao");
            tbLink.Text = xc.taobaoHTM(tbID, "1");

            string tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "freePhone");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text = tel + "&nbsp;";
            }
            tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "mobile");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
            }
            tel = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webTel");
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
            }

            appKey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        if (!IsPostBack)
        {
            long adSize = xc.SafeNum(Request.QueryString["size"]);
            if (adSize < 1)
            {
                adSize = 300;
            }
            double topSql = Math.Ceiling(adSize / 37.5);
            if (topSql % 2 == 1)
            {
                topSql -= 1;
            }
            adSize    = adSize - 2;
            adSizeStr = adSize.ToString();

            string f = Request.QueryString["f"];
            if (!string.IsNullOrEmpty(f as string))
            {
                fontColor = f;
            }
            string c = Request.QueryString["c"];
            if (!string.IsNullOrEmpty(c as string))
            {
                bgColor = c;
            }
            string a = Request.QueryString["a"];
            if (!string.IsNullOrEmpty(a as string))
            {
                alpha = a;
            }

            string    strSql = "select top " + topSql.ToString() + " * from (select title,nick,pic_url,price,click_url,shop_click_url from taobaoKe where isBad>0 and commission>0 and isGood>0) as newGood order by newid()";
            DataTable dt     = db.getDataTable(strSql);
            if (dt.Rows.Count < 1)
            {
                strSql = "select top " + topSql.ToString() + " * from (select top 100 title,nick,pic_url,price,click_url,shop_click_url from taobaoKe where isBad>0 and commission>0 order by volume DESC) as news order by newid()";
                dt     = db.getDataTable(strSql);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string pic = dt.Rows[i]["pic_url"].ToString().Trim() + "_310x310.jpg";
                kinSlideshow.Text += "<a href=\"" + dt.Rows[i]["click_url"].ToString().Trim() + "\" target=\"_blank\"><img src=\"" + pic + "\" style=\"height:" + adSizeStr + "px; width:" + adSizeStr + "px;\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" /></a>";
            }
            dt.Dispose();
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc=new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        if (!IsPostBack)
        {
            long adSize = xc.SafeNum(Request.QueryString["size"]);
            if (adSize < 1)
            {
                adSize = 300;
            }
            double topSql = Math.Ceiling(adSize / 37.5);
            if (topSql % 2 == 1)
            {
                topSql -= 1;
            }
            adSize = adSize - 2;
            adSizeStr = adSize.ToString();

            string f = Request.QueryString["f"];
            if (!string.IsNullOrEmpty(f as string))
            {
                fontColor = f;
            }
            string c = Request.QueryString["c"];
            if (!string.IsNullOrEmpty(c as string))
            {
                bgColor = c;
            }
            string a = Request.QueryString["a"];
            if (!string.IsNullOrEmpty(a as string))
            {
                alpha = a;
            }

            string strSql = "select top " + topSql.ToString() + " * from (select title,nick,pic_url,price,click_url,shop_click_url from taobaoKe where isBad>0 and commission>0 and isGood>0) as newGood order by newid()";
            DataTable dt = db.getDataTable(strSql);
            if (dt.Rows.Count < 1)
            {
                strSql = "select top " + topSql.ToString() + " * from (select top 100 title,nick,pic_url,price,click_url,shop_click_url from taobaoKe where isBad>0 and commission>0 order by volume DESC) as news order by newid()";
                dt = db.getDataTable(strSql);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string pic = dt.Rows[i]["pic_url"].ToString().Trim() + "_310x310.jpg";
                kinSlideshow.Text += "<a href=\"" + dt.Rows[i]["click_url"].ToString().Trim() + "\" target=\"_blank\"><img src=\"" + pic + "\" style=\"height:" + adSizeStr + "px; width:" + adSizeStr + "px;\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" /></a>";
            }
            dt.Dispose();
        }
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        xc.CheckAdminLogin("|adsDel|");

        dbDataFunction db = new dbDataFunction();
        string returnValue = string.Empty;

        long idTemp = xc.SafeNum(Request["id"].Trim());

        returnValue = db.DelDB("ads", "aID", xc.SafeSql(Request["id"].Trim()).ToString(), string.Empty, false, "adImg");

        xc.insertMyLog(xc.adminID, "admin", "删除广告");

        xc.divError("", returnValue, 350, 150, Server.UrlDecode(xc.errorUrlTwo), "goto");
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("|adsDel|");

        dbDataFunction db          = new dbDataFunction();
        string         returnValue = string.Empty;

        long idTemp = xc.SafeNum(Request["id"].Trim());

        returnValue = db.DelDB("ads", "aID", xc.SafeSql(Request["id"].Trim()).ToString(), string.Empty, false, "adImg");

        xc.insertMyLog(xc.adminID, "admin", "删除广告");

        xc.divError("", returnValue, 350, 150, Server.UrlDecode(xc.errorUrlTwo), "goto");
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        xc.CheckAdminLogin("|adminDel|");

        if (!xc.adminID.Equals(xc.SafeSql(Request["id"].Trim()).ToString()))
        {
            string returnValue = new dbDataFunction().DelDB("AdminUser", "UserId", xc.SafeSql(Request["id"].Trim()).ToString(), string.Empty, false, string.Empty);

            xc.insertMyLog(xc.adminID, "admin", "删除管理员");

            xc.divError("", returnValue, 350, 150, "userList.aspx", "goto");
        }
        else
        {
            xc.divError("", "不会吧,删除自己呀!", 350, 150, "userList.aspx", "goto");
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("|adminDel|");

        if (!xc.adminID.Equals(xc.SafeSql(Request["id"].Trim()).ToString()))
        {
            string returnValue = new dbDataFunction().DelDB("AdminUser", "UserId", xc.SafeSql(Request["id"].Trim()).ToString(), string.Empty, false, string.Empty);

            xc.insertMyLog(xc.adminID, "admin", "删除管理员");

            xc.divError("", returnValue, 350, 150, "userList.aspx", "goto");
        }
        else
        {
            xc.divError("", "不会吧,删除自己呀!", 350, 150, "userList.aspx", "goto");
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();
        XabaraClass xClass = new XabaraClass();

        xc.CheckAdminLogin("");

        DataTable dt = db.getDataTable("select Tid,TreeType from newsTree order by Tid");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            long cid = xc.SafeNum(dt.Rows[i]["Tid"].ToString().Trim());
            xClass.treeNameUpdate(cid);
            xClass.updateID(dt.Rows[i]["TreeType"].ToString().Trim(), cid);

            Response.Write("正在更新第 " + cid.ToString() + " 条<br />");
            Response.Flush();
        }
        dt.Dispose();

        Response.Write("更新全站缓存完成!");
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("");

        dbDataFunction db = new dbDataFunction();

        Response.Write("自动清除淘画报,如出现死机或出错,重新点击自动更新即可;<br /><br />");
        Response.Flush();

        //清除低佣金的画报
        db.exeSql("delete from taobaoKe where commission<5 and classID=0 and postDate<'" + DateTime.Now.AddDays(-15).ToString() + "'");
        //清除无佣金商品
        db.exeSql("delete from taobaoKe where isBad=0 and poster_id>0 and classID=0");

        DataTable dt = db.getDataTable("select id,title from posterChannelTitle order by tID DESC");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string    idTemp = dt.Rows[i]["id"].ToString().Trim();
            string    strSql = "select title from taobaoKe left join posterTkID on taobaoKe.num_iid=posterTkID.tK_num_iid where taobaoKe.isBad>0 and posterTkID.title_id=" + idTemp.ToString() + " order by commission DESC,volume DESC";
            DataTable ifDt   = db.getDataTable(strSql);
            if (ifDt.Rows.Count < 10)
            {
                db.DelDB("posterChannelTitle", "id", idTemp.ToString(), "", false, "");
                db.DelDB("posterTkID", "title_id", idTemp.ToString(), "", false, "");

                Response.Write("自动清除 " + dt.Rows[i]["title"].ToString().Trim() + " 成功!<br />");
                Response.Flush();
            }
            ifDt.Dispose();
        }
        dt.Dispose();

        Response.Write("自动清除淘画报完成!<br /><br />");
        Response.Flush();
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc     = new XabaraCom();
        dbDataFunction db     = new dbDataFunction();
        XabaraClass    xClass = new XabaraClass();

        xc.CheckAdminLogin("");

        DataTable dt = db.getDataTable("select Tid,TreeType from newsTree order by Tid");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            long cid = xc.SafeNum(dt.Rows[i]["Tid"].ToString().Trim());
            xClass.treeNameUpdate(cid);
            xClass.updateID(dt.Rows[i]["TreeType"].ToString().Trim(), cid);

            Response.Write("正在更新第 " + cid.ToString() + " 条<br />");
            Response.Flush();
        }
        dt.Dispose();

        Response.Write("更新全站缓存完成!");
    }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc    = new XabaraCom();
        dbDataFunction db    = new dbDataFunction();
        string         title = "找店铺 ZDianPU.com";

        if (!IsPostBack)
        {
            long idTemp = xc.SafeNum(Request.QueryString["id"]);
            if (idTemp < 1)
            {
                string urlID = Page.RouteData.Values["sID"].ToString();
                urlID  = urlID.Replace(".htm", "");
                idTemp = xc.SafeNum(urlID);
            }

            DataTable dt = db.getDataTable("select title,pic_url,click_url from taobaoKe where num_iid=" + idTemp.ToString());
            if (dt.Rows.Count > 0)
            {
                title                  = dt.Rows[0]["title"].ToString().Trim();
                linkWebName.Text       = title;
                urlStr                 = dt.Rows[0]["click_url"].ToString().Trim();
                img.Text               = "<a href=\"" + urlStr + "\"><img id=\"imgshow\" src=\"" + dt.Rows[0]["pic_url"].ToString().Trim() + "\" style=\"width:350px; height:350px;\" title=\"" + title + "\" alt=\"" + title + "\" /></a>";
                linkWebUrl.NavigateUrl = urlStr;
            }
            else
            {
                Response.Redirect("http://s.click.taobao.com/t_9?p=mm_14288563_0_0&l=http%3A%2F%2Fwww.tmall.com", true);
            }
            dt.Dispose();

            xc.webMeta(Page, title, XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr"));
            countStr.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "countScript");
        }

        this.Page.Title = title + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();
        string title = "找店铺 ZDianPU.com";

        if (!IsPostBack)
        {
            long idTemp = xc.SafeNum(Request.QueryString["id"]);
            if (idTemp < 1)
            {
                string urlID = Page.RouteData.Values["sID"].ToString();
                urlID = urlID.Replace(".htm", "");
                idTemp = xc.SafeNum(urlID);
            }

            DataTable dt = db.getDataTable("select title,pic_url,click_url from taobaoKe where num_iid=" + idTemp.ToString());
            if (dt.Rows.Count > 0)
            {
                title = dt.Rows[0]["title"].ToString().Trim();
                linkWebName.Text = title;
                urlStr = dt.Rows[0]["click_url"].ToString().Trim();
                img.Text = "<a href=\"" + urlStr + "\"><img id=\"imgshow\" src=\"" + dt.Rows[0]["pic_url"].ToString().Trim() + "\" style=\"width:350px; height:350px;\" title=\"" + title + "\" alt=\"" + title + "\" /></a>";
                linkWebUrl.NavigateUrl = urlStr;
            }
            else
            {
                Response.Redirect("http://s.click.taobao.com/t_9?p=mm_14288563_0_0&l=http%3A%2F%2Fwww.tmall.com", true);
            }
            dt.Dispose();

            xc.webMeta(Page, title, XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr"));
            countStr.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "countScript");
        }

        this.Page.Title = title + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");
    }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        xc.CheckAdminLogin("");

        dbDataFunction db = new dbDataFunction();

        Response.Write("自动清除淘画报,如出现死机或出错,重新点击自动更新即可;<br /><br />");
        Response.Flush();

        //清除低佣金的画报
        db.exeSql("delete from taobaoKe where commission<5 and classID=0 and postDate<'" + DateTime.Now.AddDays(-15).ToString() + "'");
        //清除无佣金商品
        db.exeSql("delete from taobaoKe where isBad=0 and poster_id>0 and classID=0");

        DataTable dt = db.getDataTable("select id,title from posterChannelTitle order by tID DESC");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string idTemp = dt.Rows[i]["id"].ToString().Trim();
            string strSql = "select title from taobaoKe left join posterTkID on taobaoKe.num_iid=posterTkID.tK_num_iid where taobaoKe.isBad>0 and posterTkID.title_id=" + idTemp.ToString() + " order by commission DESC,volume DESC";
            DataTable ifDt = db.getDataTable(strSql);
            if (ifDt.Rows.Count < 10)
            {
                db.DelDB("posterChannelTitle", "id", idTemp.ToString(), "", false, "");
                db.DelDB("posterTkID", "title_id", idTemp.ToString(), "", false, "");

                Response.Write("自动清除 " + dt.Rows[i]["title"].ToString().Trim() + " 成功!<br />");
                Response.Flush();
            }
            ifDt.Dispose();
        }
        dt.Dispose();

        Response.Write("自动清除淘画报完成!<br /><br />");
        Response.Flush();
    }
Ejemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();
        xabaraAD ad = new xabaraAD();
        XabaraClass xClass = new XabaraClass();
        webPublic wp = new webPublic();

        this.Page.Title = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");

        if (!IsPostBack)
        {
            DataTable dt;
            dt = db.getDataTable("select top 5 Tid,TreeName from NewsTree where taobaoKe<>'' order by newid() ");
            for (int i = 0; i < 5; i++)
            {
                ppRnd.Text += "<a href=\"/" + dt.Rows[i]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\">" + dt.Rows[i]["TreeName"].ToString().Trim() + "</a>";
                if (i < 4)
                {
                    ppRnd.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
            }
            dt.Dispose();

            ad468.Text = ad.getAdCode(0, 468, 60, 1, 0, true, string.Empty);
            long adID = 116;

            vipCode.Text = "<div class=\"divWidth\"><a href=\"/278.htm\" target=\"_blank\"><img src=\"/ad/images/okitch_20120630.gif\" /></a></div><div class=\"height5px\"></div>";

            //淘画报
            dt = db.getDataTable("select top 5 id,title,title_short,cover_pic_url_h,cover_pic_url_w from posterChannelTitle where flagID>0 and weight>10000 and modified_date>'" + DateTime.Now.AddDays(-7) + "' order by newid()");
            if (dt.Rows.Count > 4)
            {
                HuaBaoLeft.Text = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;\"><tr>";
                string txtLink = string.Empty;
                for (int i = 0; i < 3; i++)
                {
                    HuaBaoLeft.Text += "<td style=\"text-align:center; width:190px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\"><img src=\"" + dt.Rows[i]["cover_pic_url_h"].ToString().Trim() + "\" class=\"picHuaBaoH\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title_short"].ToString().Trim() + "\" id=\"imghbh\" /></a></td>";

                    txtLink += "<td style=\"text-align:center; height:28px; line-height:28px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\" class=\"huabao\">" + dt.Rows[i]["title_short"].ToString().Trim() + "</a></td>";
                }
                HuaBaoLeft.Text += "</tr><tr>" + txtLink + "</tr></table>";

                HuaBaoRight.Text = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;\"><tr>";
                txtLink = string.Empty;
                for (int i = 3; i < 5; i++)
                {
                    HuaBaoRight.Text += "<td style=\"text-align:center; width:190px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\"><img src=\"" + dt.Rows[i]["cover_pic_url_w"].ToString().Trim() + "\" class=\"picHuaBaoW\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title_short"].ToString().Trim() + "\" id=\"imghbw\" /></a></td>";

                    txtLink += "<td style=\"text-align:center; height:32px; line-height:32px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\" class=\"huabao\">" + dt.Rows[i]["title_short"].ToString().Trim() + "</a></td>";
                }
                HuaBaoRight.Text += "</tr><tr>" + txtLink + "</tr><tr><td colspan=\"2\" style=\"padding-top:5px;\"><table align=\"center\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;width:98%;\"><tr><td style=\"text-align:left;\">" + ad.getAdCode(335, 0, 0, 3, 1, true, "") + "</td><td style=\"text-align:right;\">" + ad.getAdCode(334, 0, 0, 1, 0, true, "") + "</td></tr></table></td></tr></table>";
            }
            else
            {
                huabao.Visible = false;
            }
            dt.Dispose();

            //导航及产品
            headMenu.Text = "<td valign=\"middle\" class=\"headBg2\"><a href=\"/\" target=\"_top\" class=\"head\">网站首页</a></td>";
            dt = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();

                //广告代码
                adID += 1;
                string adCodeWidth = ad.getAdCode(adID, 0, 0, 1, 1, true, "");
                int shopNums = 12;   //每个版块读取商品数
                if (!string.IsNullOrEmpty(adCodeWidth as string))
                {
                    adCodeWidth = "<div class=\"divWidth\">" + adCodeWidth + "</div>";
                }
                string adCodeHeight = ad.getAdCode(adID + 8, 0, 0, 1, 1, true, "");
                if (string.IsNullOrEmpty(adCodeHeight as string))
                {
                    DataTable ppDt = db.getDataTable("select top 22 Tid,TreeName from NewsTree where taobaoKe<>'' and idLayerStr like '%|" + tid + "|%' order by listID ASC,Tid ASC ");
                    if (ppDt.Rows.Count > 0)
                    {
                        adCodeHeight = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%;\" align=\"center\" class=\"indexTable\">";
                        for (int p = 0; p < ppDt.Rows.Count; p++)
                        {
                            adCodeHeight += "<tr><td><a href=\"/" + ppDt.Rows[p]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + ppDt.Rows[p]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + ppDt.Rows[p]["TreeName"].ToString().Trim() + "\" class=\"classID\">" + ppDt.Rows[p]["TreeName"].ToString().Trim() + "</a></td></tr>";
                        }
                        adCodeHeight += "<tr><td style=\"text-align:right;\"><a href=\"/" + tid + ".htm\" target=\"_blank\" title=\"更多 " + treeName + " 品牌\" alt=\"更多 " + treeName + " 品牌\" class=\"classID\">>> 更多品牌</a></td></tr></table>";
                    }
                    ppDt.Dispose();
                }
                else
                {
                    shopNums = 12;
                }

                //商品读取
                string shopHtm = string.Empty;
                string ifStr = string.Empty;
                string cidStr = xClass.getClassAllID("taobaoke", xc.SafeNum(tid)); //得到所有ID
                if (cidStr.IndexOf(",") > 0)
                {
                    string[] ids = cidStr.Split(new char[] { ',' });
                    int iiCount = ids.GetUpperBound(0);
                    int readTop = 1;
                    if (shopNums > iiCount-5)
                    {
                        readTop = 2;
                    }

                    for (int ii = 0; ii <= iiCount; ii++)
                    {
                        ifStr += " select top " + readTop.ToString() + " num_iid,title,pic_url,click_url,commission,price,volume from taobaoke where isBad>0 and isGood>0 and classID=" + ids[ii].ToString().Trim() + " order by volume DESC union ";
                    }
                }
                else
                {
                    ifStr = " select num_iid,title,pic_url,click_url,commission,price,volume from taobaoke where isBad>0 and isGood>0 and classID=" + tid + " union ";
                }
                ifStr = "(" + ifStr.Substring(0, ifStr.Length - 6) + ") as news";

                string strSql = "select top " + shopNums.ToString() + " * from " + ifStr + " Order By newid()";
                DataTable dtShop = db.getDataTable(strSql);
                //Response.Write(strSql);
                //Response.End();
                shopHtm = string.Empty;
                for (int s = 0; s < dtShop.Rows.Count; s++)
                {
                    shopHtm += "<td valign=\"top\" style=\"border-style: none solid solid none; border-width: 1px; border-color: #323232; text-align:center; width:200px;\"><a class=\"moneyLink\" href=\"/show/" + dtShop.Rows[s]["num_iid"].ToString().Trim() + ".htm\" target=\"_blank\" alt=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" title=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\"><div style=\"position:absolute;\"><ul><li style=\"height:168px;\"></li><li class=\"moneyFont\" style=\"background-color:#323232; filter:Alpha(opacity=30);opacity:0.3; text-align:right; padding:5px; width:190px; color:#b8b8b8;\">" + xc.getMoney(dtShop.Rows[s]["price"].ToString().Trim()) + "</li></ul></div><img id=\"imgshow\" src=\"" + dtShop.Rows[s]["pic_url"].ToString().Trim() + "_310x310.jpg\" style=\"height:200px; width:200px;\" alt=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" title=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" /></a></td>";

                    if (s == 3 || s == 7)
                    {
                        shopHtm += "</tr><tr>";
                    }
                }
                dtShop.Dispose();

                headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/" + tid + ".htm\" target=\"_top\" class=\"head\">" + treeName + "</a></td>";
                //产品二级分类
                string class2 = "<span class=\"headLine\">|</span>&nbsp;";
                DataTable dtClass = db.getDataTable("select Tid,TreeName from newsTree where TreeID=" + tid + " and TreeType='taobaoke' order by ListID ASC,Tid ASC");
                for (int c = 0; c < dtClass.Rows.Count; c++)
                {
                    string classID = dtClass.Rows[c]["Tid"].ToString().Trim();
                    string className = dtClass.Rows[c]["TreeName"].ToString().Trim();
                    class2 += "<a href=\"/" + dtClass.Rows[c]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + className + "\" alt=\"查看 " + className + "\">" + className + "</a>&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
                dtClass.Dispose();

                shopList.Text += adCodeWidth;
                shopList.Text += "<div class=\"height5px\"></div>";
                shopList.Text += "<div class=\"divWidth\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px; border-collapse:collapse; height:26px; width:100%;\"><tr><td style=\"width:125px; text-align:left;\"><img src=\"images/class" + tid + ".gif\" alt=\"" + treeName + "\" title=\"" + treeName + "\" /></td><td style=\"text-align:right; vertical-align:bottom; width:807px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\">" + class2 + "</td><td style=\"text-align:right; vertical-align:bottom; width:38px;\"><a href=\"/" + tid + ".htm\" target=\"_top\"><img src=\"images/more.gif\" alt=\"更多 " + treeName + "\" title=\"更多 " + treeName + "\" /></a></td></tr></table></div>";
                shopList.Text += "<div class=\"divWidth\" style=\"height:2px; background-color:Black; font-size:0px;\"></div>";
                shopList.Text += "<div class=\"divWidth\"><table cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\" style=\"background-color:#323232; width:166px; text-align:center;\" rowspan=\"3\">" + adCodeHeight + "</td>" + shopHtm + "</tr></table></div>";
            }
            headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/default.htm\" target=\"_top\" class=\"head\">图搜画报</a></td><td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/\" target=\"_top\" class=\"head\">画报淘宝</a></td>";
            dt.Dispose();

            //热搜关键词
            string hot = XmlReader.GetConfig(HttpContext.Current.Server.MapPath("~/xabara.config"), "hotSearch");
            string[] hotWord = hot.Split(new char[] { ',' });
            for (int h = 0; h <= hotWord.GetUpperBound(0); h++)
            {
                hotSearch.Text += "<a href=\"/search.htm?keyWord=" + Server.UrlEncode(hotWord[h]) + "\" target=\"_top\" title=\"搜索 " + hotWord[h] + "\">" + hotWord[h] + "</a>&nbsp;";
            }

            this.Page.MetaKeywords = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "KeyWord");
            this.Page.MetaDescription = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr");
        }
    }
Ejemplo n.º 16
0
    protected void addMoney_Click(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        string imgFile       = adImg.Text.Trim();
        string uploadFileStr = string.Empty;

        if (!imgFile.Equals("Code"))
        {
            uploadFileStr = xc.UploadFile(imgUpload, imgFile, false);
        }
        string url     = adHttp.Text;
        string newFile = string.Empty;

        if (uploadFileStr.Equals("上传成功"))   //上传文件判断
        {
            newFile = Session["NewFile"].ToString().Trim();
        }

        string strDim = "@classID,@adW,@adH,@adImg,@adHttp,@adCode,@starDate,@stopDate,@postDate,@postIP,@adminID";

        string[] strValue = new string[11];

        strValue[0] = adClass.Text;
        strValue[1] = adW.Text;
        strValue[2] = adH.Text;
        strValue[3] = newFile;
        strValue[4] = url;
        if (string.IsNullOrEmpty(adCode.Text as string))
        {
            if (imgFile.Equals("Img"))
            {
                if (!string.IsNullOrEmpty(url as string))
                {
                    strValue[5] = "<a href=\"" + url + "\" target=\"_blank\"><img src=\"http://" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webDomains") + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" /></a>";
                }
                else
                {
                    strValue[5] = "<img src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\"  style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" />";
                }
            }
            else
            {
                strValue[5] = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" height=\"" + adH.Text + "\" width=\"" + adW.Text + "\"><param name=\"quality\" value=\"high\" /><param name=\"movie\" value=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" /><embed height=\"" + adH.Text + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" type=\"application/x-shockwave-flash\" width=\"" + adW.Text + "\"></embed></object>";
            }
        }
        else
        {
            strValue[5] = adCode.Text;
        }
        strValue[6]  = pDate.Text;
        strValue[7]  = eDate.Text;
        strValue[8]  = DateTime.Now.ToString();
        strValue[9]  = xc.GetIP();
        strValue[10] = xc.adminID;

        if (!string.IsNullOrEmpty(newFile as string) || !string.IsNullOrEmpty(adCode.Text as string))
        {
            xc.insertMyLog(xc.adminID, "admin", "发布广告");
            xc.divError("", db.InsertUpdateDB("ads", strDim, strValue, string.Empty), 350, 150, "default.aspx", "goto");
        }
        else
        {
            xc.divError("", "请上传广告图片或直接粘贴广告代码!", 350, 150, "add.aspx", "goto");
        }
    }
Ejemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");

        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url       = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        Response.Write("自动同步淘画报,如出现死机或出错,重新点击自动更新即可;<br /><br />");
        Response.Flush();

        string     requestType         = Request.QueryString["type"];
        ITopClient client              = new DefaultTopClient(url, appkey, appsecret);
        PosterPostersSearchRequest req = new PosterPostersSearchRequest();

        req.PageSize        = 20L;
        req.PageNo          = 1L;
        req.EditorRecommend = 1L;
        req.SortType        = 4L;

        string strDim = "@id,@channel_id,@cover_pic_url_w,@cover_pic_url_h,@title,@title_short,@tag,@hits,@weight,@create_date,@modified_date,@isGood,@postID,@postIP,@postDate,@flagID";

        string[] strValue = new string[30];

        string posterId = string.Empty;

        dt = db.getDataTable("select id from posterChannelIDs where isFlag>0 order by newid()");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            //获取画报标题
            req.ChannelIds = dt.Rows[i]["id"].ToString().Trim();
            PosterPostersSearchResponse response = client.Execute(req);

            for (int ii = 0; ii < response.Posters.Count; ii++)
            {
                strValue[0] = response.Posters[ii].Id.ToString();
                //标题ID赋值
                posterId    = strValue[0];
                strValue[1] = response.Posters[ii].ChannelId.ToString();
                strValue[2] = string.Empty;
                strValue[3] = string.Empty;
                string pic = response.Posters[ii].CoverPicUrl.ToString();
                if (!string.IsNullOrEmpty(pic as string))
                {
                    string[] img = pic.Split(new char[] { ',' });
                    strValue[2] = img[0];
                    strValue[3] = img[img.GetUpperBound(0)];
                }
                strValue[4]  = response.Posters[ii].Title;
                strValue[5]  = response.Posters[ii].TitleShort;
                strValue[6]  = response.Posters[ii].Tag;
                strValue[7]  = response.Posters[ii].Hits.ToString();
                strValue[8]  = response.Posters[ii].Weight.ToString();
                strValue[9]  = response.Posters[ii].CreateDate.ToString();
                strValue[10] = response.Posters[ii].ModifiedDate.ToString();
                strValue[11] = "0";
                strValue[12] = xc.adminID;
                strValue[13] = xc.GetIP();
                strValue[14] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                strValue[15] = "1";                                                                        //默认正常

                DataTable dtIF = db.getDataTable("select * from posterChannelTitle where id=" + posterId); //防止重复插入
                if (dtIF.Rows.Count > 0)
                {
                    strValue[8] = dtIF.Rows[0]["weight"].ToString().Trim();
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, "id=" + posterId);
                }
                else
                {
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, string.Empty);
                }
                dtIF.Dispose();

                Response.Write("<br />同步 " + strValue[4] + " 已完成;<br />");
                Response.Flush();

                //获取关联商品
                PosterPostauctionsGetRequest poster = new PosterPostauctionsGetRequest();
                poster.PosterId = long.Parse(posterId);
                PosterPostauctionsGetResponse rsp = client.Execute(poster);
                int c = rsp.Posterauctions.Count;
                if (c > 9)
                {
                    string strDim2 = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id,@auction_short_title";
                    for (int s = 0; s < c; s++)
                    {
                        strValue[0]  = "0";
                        strValue[1]  = rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[2]  = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                        strValue[3]  = "找店铺 ZdianPU.com";
                        strValue[4]  = "/images/WaterMark.png";
                        strValue[5]  = rsp.Posterauctions[s].AuctionPrice.ToString();
                        strValue[6]  = @"http://item.taobao.com/item.htm?id=" + rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[7]  = "0";
                        strValue[8]  = "0";
                        strValue[9]  = "0";
                        strValue[10] = "0";
                        strValue[11] = @"http://www.zdianpu.com";
                        strValue[12] = "0";
                        strValue[13] = "找店铺";
                        strValue[14] = "0";
                        strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                        strValue[16] = xc.adminID;
                        strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        strValue[18] = xc.GetIP();
                        strValue[19] = "1";
                        strValue[20] = "0";
                        strValue[21] = rsp.Posterauctions[s].PosterId.ToString();
                        strValue[22] = rsp.Posterauctions[s].AuctionShortTitle.ToString();

                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[0] = rsp.Posterauctions[s].PosterId.ToString();
                            strValue[1] = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                            db.InsertUpdateDB("taobaoKe", "@poster_id,@auction_short_title", strValue, "num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim2, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }

                    //淘宝客自动更新操作
                    for (int f = 0; f < 100; f++)
                    {
                        string id = string.Empty;

                        DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where poster_id=" + posterId + " and isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
                        if (tkIDs.Rows.Count > 0)
                        {
                            Response.Write("淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString() + "<br />");
                            Response.Flush();

                            for (int t = 0; t < tkIDs.Rows.Count; t++)
                            {
                                id += tkIDs.Rows[t]["num_iid"].ToString().Trim() + ",";
                            }
                            id = id.Substring(0, id.Length - 1);

                            //锁定淘宝客更新条数
                            strValue[0] = "0";
                            string updateID = id.Replace(",", " or num_iid=");
                            updateID = "num_iid=" + updateID;
                            //Response.Write(updateID);
                            //Response.End();
                            db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);
                        }
                        else
                        {
                            break;
                        }
                        tkIDs.Dispose();

                        //Response.Write(id.ToString());

                        if (!string.IsNullOrEmpty(id as string))
                        {
                            TaobaokeItemsConvertRequest reqTk = new TaobaokeItemsConvertRequest();
                            reqTk.Fields  = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                            reqTk.Nick    = alimamaID;
                            reqTk.NumIids = id;
                            TaobaokeItemsConvertResponse responseTk = client.Execute(reqTk);

                            int tkCount = responseTk.TaobaokeItems.Count; //转换后得到的淘客数量

                            string strDim3 = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                            for (int tk = 0; tk < tkCount; tk++)
                            {
                                strValue[0]  = responseTk.TaobaokeItems[tk].NumIid.ToString();
                                strValue[1]  = responseTk.TaobaokeItems[tk].Title.ToString();
                                strValue[2]  = responseTk.TaobaokeItems[tk].Nick.ToString();
                                strValue[3]  = responseTk.TaobaokeItems[tk].PicUrl.ToString();
                                strValue[4]  = responseTk.TaobaokeItems[tk].Price.ToString();
                                strValue[5]  = responseTk.TaobaokeItems[tk].ClickUrl.ToString();
                                strValue[6]  = responseTk.TaobaokeItems[tk].Commission.ToString();
                                strValue[7]  = responseTk.TaobaokeItems[tk].CommissionRate;
                                strValue[8]  = responseTk.TaobaokeItems[tk].CommissionNum.ToString();
                                strValue[9]  = responseTk.TaobaokeItems[tk].CommissionVolume.ToString();
                                strValue[10] = responseTk.TaobaokeItems[tk].ShopClickUrl.ToString();
                                strValue[11] = responseTk.TaobaokeItems[tk].SellerCreditScore.ToString();
                                strValue[12] = responseTk.TaobaokeItems[tk].ItemLocation.ToString();
                                strValue[13] = responseTk.TaobaokeItems[tk].Volume.ToString();
                                strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                                strValue[15] = "1";

                                db.InsertUpdateDB("taobaoKe", strDim3, strValue, " num_iid =" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                //更新商品一对多关联表
                                DataTable dtIf = db.getDataTable("select * from posterTkID with(nolock) where title_id=" + posterId + " and tK_num_iid=" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                if (dtIf.Rows.Count < 1)  //防止重复插入
                                {
                                    strValue[0] = posterId;
                                    strValue[1] = responseTk.TaobaokeItems[tk].NumIid.ToString();

                                    db.InsertUpdateDB("posterTkID", "@title_id,@tK_num_iid", strValue, "");
                                }
                                dtIf.Dispose();
                            }
                        }
                    }
                }
                else
                {
                    db.DelDB("posterChannelTitle", "id", response.Posters[ii].Id.ToString(), "", false, "");
                }
            }
        }
        dt.Dispose();
    }
Ejemplo n.º 18
0
    protected void addMoney_Click(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        string imgFile = adImg.Text.Trim();
        string uploadFileStr = string.Empty;
        if (!imgFile.Equals("Code"))
        {
            uploadFileStr = xc.UploadFile(imgUpload, imgFile, false);
        }
        string url = adHttp.Text;
        string newFile = string.Empty;

        if (uploadFileStr.Equals("上传成功"))   //上传文件判断
        {
            newFile = Session["NewFile"].ToString().Trim();
        }

        string strDim = "@classID,@adW,@adH,@adImg,@adHttp,@adCode,@starDate,@stopDate,@postDate,@postIP,@adminID";
        string[] strValue = new string[11];

        strValue[0] = adClass.Text;
        strValue[1] = adW.Text;
        strValue[2] = adH.Text;
        strValue[3] = newFile;
        strValue[4] = url;
        if (string.IsNullOrEmpty(adCode.Text as string))
        {
            if (imgFile.Equals("Img"))
            {
                if (!string.IsNullOrEmpty(url as string))
                {
                    strValue[5] = "<a href=\"" + url + "\" target=\"_blank\"><img src=\"http://" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webDomains") + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" /></a>";
                }
                else
                {
                    strValue[5] = "<img src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\"  style=\"boder:0px;width:" + adW.Text + "px;height:" + adH.Text + "px\" />";
                }
            }
            else
            {
                strValue[5] = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" height=\"" + adH.Text + "\" width=\"" + adW.Text + "\"><param name=\"quality\" value=\"high\" /><param name=\"movie\" value=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" /><embed height=\"" + adH.Text + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"" + xc.UploadFolder + newFile.Substring(5, 8) + "/" + newFile + "\" type=\"application/x-shockwave-flash\" width=\"" + adW.Text + "\"></embed></object>";
            }
        }
        else
        {
            strValue[5] = adCode.Text;
        }
        strValue[6] = pDate.Text;
        strValue[7] = eDate.Text;
        strValue[8] = DateTime.Now.ToString();
        strValue[9] = xc.GetIP();
        strValue[10] = xc.adminID;

        if (!string.IsNullOrEmpty(newFile as string) || !string.IsNullOrEmpty(adCode.Text as string))
        {
            xc.insertMyLog(xc.adminID, "admin", "发布广告");
            xc.divError("", db.InsertUpdateDB("ads", strDim, strValue, string.Empty), 350, 150, "default.aspx", "goto");
        }
        else
        {
            xc.divError("", "请上传广告图片或直接粘贴广告代码!", 350, 150, "add.aspx", "goto");
        }
    }
Ejemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        string strDim = string.Empty;

        string[] strValue = new string[30];

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");

        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url       = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);

        Response.Write("只针对于过期或无效淘宝客再次请求转换有效链接,如出现死机或出错,重新点击<a href=\"taobaoke.aspx\">自动更新</a>即可;<br />");
        Response.Flush();

        string strSql = string.Empty;

        //淘宝客自动更新操作
        for (int f = 0; f < 5; f++)
        {
            string id = string.Empty;

            DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where updateDate<GETDATE() order by newid()");    //30天过期内的数据可再次更新
            if (tkIDs.Rows.Count > 0)
            {
                Response.Write("<br />淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString());
                Response.Flush();

                for (int i = 0; i < tkIDs.Rows.Count; i++)
                {
                    id += tkIDs.Rows[i]["num_iid"].ToString().Trim() + ",";
                }
                id = id.Substring(0, id.Length - 1);

                //锁定淘宝客更新条数
                strValue[0] = "0";
                string updateID = id.Replace(",", " or num_iid=");
                updateID = "num_iid=" + updateID;
                //Response.Write(updateID);
                //Response.End();
                db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);
            }
            else
            {
                Response.Write("<br />当前淘宝客数据转换已全部完成!");
                break;
            }
            tkIDs.Dispose();

            //Response.Write(id.ToString());

            if (!string.IsNullOrEmpty(id as string))
            {
                TaobaokeItemsConvertRequest req = new TaobaokeItemsConvertRequest();
                req.Fields  = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                req.Nick    = alimamaID;
                req.NumIids = id;
                TaobaokeItemsConvertResponse response = client.Execute(req);

                int tkCount = response.TaobaokeItems.Count; //转换后得到的淘客数量

                strDim = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                for (int i = 0; i < tkCount; i++)
                {
                    strValue[0]  = response.TaobaokeItems[i].NumIid.ToString();
                    strValue[1]  = response.TaobaokeItems[i].Title.ToString();
                    strValue[2]  = response.TaobaokeItems[i].Nick.ToString();
                    strValue[3]  = response.TaobaokeItems[i].PicUrl.ToString();
                    strValue[4]  = response.TaobaokeItems[i].Price.ToString();
                    strValue[5]  = response.TaobaokeItems[i].ClickUrl.ToString();
                    strValue[6]  = response.TaobaokeItems[i].Commission.ToString();
                    strValue[7]  = response.TaobaokeItems[i].CommissionRate;
                    strValue[8]  = response.TaobaokeItems[i].CommissionNum.ToString();
                    strValue[9]  = response.TaobaokeItems[i].CommissionVolume.ToString();
                    strValue[10] = response.TaobaokeItems[i].ShopClickUrl.ToString();
                    strValue[11] = response.TaobaokeItems[i].SellerCreditScore.ToString();
                    strValue[12] = response.TaobaokeItems[i].ItemLocation.ToString();
                    strValue[13] = response.TaobaokeItems[i].Volume.ToString();
                    strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[15] = "1";

                    db.InsertUpdateDB("taobaoKe", strDim, strValue, " num_iid =" + response.TaobaokeItems[i].NumIid.ToString());
                }
            }
        }

        Response.Clear();
        this.js();  //定时刷新
    }
Ejemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;
        string strDim = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id";
        string[] strValue = new string[30];

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);

        Response.Write("根据分类自动同步淘宝客开始,如出现死机或出错,重新点击<a href=\"taobao.aspx\">自动更新</a>即可;<br />");
        Response.Flush();

        this.js();  //定时刷新

        //更新店铺
        DateTime t = DateTime.Now.Date;
        string strSql = "select top 1 * from NewsTree with(nolock) where taobaoKe <>'' and PostDate<'" + t.ToString() + "' order by newid()";
        dt = db.getDataTable(strSql); //当天不再请求更新
        if (dt.Rows.Count > 0)
        {
            string classID = dt.Rows[0]["Tid"].ToString().Trim();
            Response.Write("<br />" + dt.Rows[0]["treeNameTxt"].ToString().Trim() + " 同步完成!");
            Response.Flush();
            //System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 10));

            ItemsGetRequest req = new ItemsGetRequest();
            req.Fields = "num_iid,title,nick,pic_url,cid,price,type,delist_time,post_fee,score,volume";
            req.Nicks = dt.Rows[0]["taobaoKe"].ToString().Trim();
            req.PageNo = 1L;
            req.OrderBy = "volume";
            req.StartPrice = 50L;
            req.EndPrice = 100000L;
            req.PageSize = 200L;    //取最畅销前200个商品
            ItemsGetResponse response = client.Execute(req);
            long shopNums = response.TotalResults;

            if (shopNums > 0)
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步

                for (int ii = 0; ii < response.Items.Count; ii++)
                {
                    strValue[0] = classID;
                    strValue[1] = response.Items[ii].NumIid.ToString();
                    strValue[2] = response.Items[ii].Title;
                    strValue[3] = response.Items[ii].Nick;
                    strValue[4] = response.Items[ii].PicUrl;
                    strValue[5] = response.Items[ii].Price;
                    strValue[6] = @"http://item.taobao.com/item.htm?id=" + response.Items[ii].NumIid.ToString();
                    strValue[7] = "0";
                    strValue[8] = "0";
                    strValue[9] = "0";
                    strValue[10] = "0";
                    strValue[11] = @"http://www.zdianpu.com";
                    strValue[12] = "0";
                    strValue[13] = "找店铺";
                    strValue[14] = response.Items[ii].Volume.ToString();
                    strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                    strValue[16] = "sys";
                    strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[18] = xc.GetIP();
                    strValue[19] = "1";
                    strValue[20] = "0";
                    strValue[21] = "0";

                    if (response.Items[ii].Title.IndexOf("邮费") < 0 || response.Items[ii].Title.IndexOf("补差") < 0)
                    {
                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + response.Items[ii].NumIid.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[6] = dtIf.Rows[0]["click_url"].ToString().Trim();
                            strValue[7] = dtIf.Rows[0]["commission"].ToString().Trim();
                            strValue[8] = dtIf.Rows[0]["commission_rate"].ToString().Trim();
                            strValue[9] = dtIf.Rows[0]["commission_num"].ToString().Trim();
                            strValue[10] = dtIf.Rows[0]["commission_volume"].ToString().Trim();
                            strValue[11] = dtIf.Rows[0]["shop_click_url"].ToString().Trim();
                            strValue[12] = dtIf.Rows[0]["seller_credit_score"].ToString().Trim();
                            strValue[13] = dtIf.Rows[0]["item_location"].ToString().Trim();
                            strValue[15] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            strValue[17] = dtIf.Rows[0]["postDate"].ToString().Trim();
                            strValue[20] = dtIf.Rows[0]["isGood"].ToString().Trim();
                            strValue[21] = dtIf.Rows[0]["poster_id"].ToString().Trim(); //淘画报

                            db.InsertUpdateDB("taobaoKe", strDim, strValue, "num_iid=" + response.Items[ii].NumIid.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }
                }
            }
            else
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步时出错或非淘宝客,防止死锁
            }
        }
        //宝贝同步结束

        dt.Dispose();

        //淘宝客自动更新操作
        for (int f = 0; f < 5; f++)
        {
            string id = string.Empty;

            DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
            if (tkIDs.Rows.Count > 0)
            {
                for (int i = 0; i < tkIDs.Rows.Count; i++)
                {
                    id += tkIDs.Rows[i]["num_iid"].ToString().Trim() + ",";
                }
                id = id.Substring(0, id.Length - 1);

                //锁定淘宝客更新条数
                strValue[0] = "0";
                string updateID = id.Replace(",", " or num_iid=");
                updateID = "num_iid=" + updateID;
                //Response.Write(updateID);
                //Response.End();
                db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);

                Response.Write("<br />淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString()+",请等待10秒...");
                Response.Flush();
            }
            else
            {
                Response.Write("<br />当前淘宝客数据转换已全部完成,请明天再手动更新!");
                break;
            }
            tkIDs.Dispose();

            //Response.Write(id.ToString());

            if (!string.IsNullOrEmpty(id as string))
            {
                TaobaokeItemsConvertRequest req = new TaobaokeItemsConvertRequest();
                req.Fields = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                req.Nick = alimamaID;
                req.NumIids = id;
                TaobaokeItemsConvertResponse response = client.Execute(req);

                int tkCount = response.TaobaokeItems.Count; //转换后得到的淘客数量

                strDim = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                for (int i = 0; i < tkCount; i++)
                {
                    strValue[0] = response.TaobaokeItems[i].NumIid.ToString();
                    strValue[1] = response.TaobaokeItems[i].Title.ToString();
                    strValue[2] = response.TaobaokeItems[i].Nick.ToString();
                    strValue[3] = response.TaobaokeItems[i].PicUrl.ToString();
                    strValue[4] = response.TaobaokeItems[i].Price.ToString();
                    strValue[5] = response.TaobaokeItems[i].ClickUrl.ToString();
                    strValue[6] = response.TaobaokeItems[i].Commission.ToString();
                    strValue[7] = response.TaobaokeItems[i].CommissionRate;
                    strValue[8] = response.TaobaokeItems[i].CommissionNum.ToString();
                    strValue[9] = response.TaobaokeItems[i].CommissionVolume.ToString();
                    strValue[10] = response.TaobaokeItems[i].ShopClickUrl.ToString();
                    strValue[11] = response.TaobaokeItems[i].SellerCreditScore.ToString();
                    strValue[12] = response.TaobaokeItems[i].ItemLocation.ToString();
                    strValue[13] = response.TaobaokeItems[i].Volume.ToString();
                    strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[15] = "1";

                    db.InsertUpdateDB("taobaoKe", strDim, strValue, " num_iid =" + response.TaobaokeItems[i].NumIid.ToString());
                }
            }
        }
    }
Ejemplo n.º 21
0
    public static void writeMap(string _fullFileName, string mapPath)
    {
        dbDataFunction db     = new dbDataFunction();
        XabaraClass    xClass = new XabaraClass();
        DataTable      dt;

        string strSql = string.Empty;
        string cidStr = string.Empty;
        string ifStr  = string.Empty;

        string id           = HttpContext.Current.Request.QueryString["id"];
        string fullFileName = _fullFileName;
        string strLoc       = string.Empty;
        string siteMapPath  = mapPath;

        FileInfo     XMLFile       = null;
        StreamWriter writerXMLFile = null;

        XMLFile       = new FileInfo(siteMapPath);
        writerXMLFile = XMLFile.CreateText(); //添加sitMap的头
        writerXMLFile.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        if (id.Equals("google"))              //google 加一句
        {
            writerXMLFile.WriteLine("<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.9\">");
        }
        else
        {
            writerXMLFile.WriteLine("<urlset>");
        }

        //频道各首页,每站固定格式
        addXMLSitMap(writerXMLFile, fullFileName, 1.0);
        addXMLSitMap(writerXMLFile, fullFileName + "/default.htm", 0.8);
        addXMLSitMap(writerXMLFile, fullFileName + "/huabao/default.htm", 0.8);

        //所有分类读取
        dt = db.getDataTable("select Tid from NewsTree where TreeType='taobaoke' order by ListID ASC,Tid ASC");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            strLoc = fullFileName + "/" + dt.Rows[i]["Tid"].ToString().Trim() + ".htm";
            addXMLSitMap(writerXMLFile, strLoc, 0.8);
        }
        dt.Dispose();

        //商品读取
        dt = db.getDataTable("select top 40000 num_iid from taobaoKe where isBad>0 order by isGood DESC,id ASC");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            strLoc = fullFileName + "/show/" + dt.Rows[i]["num_iid"].ToString().Trim() + ".htm";
            addXMLSitMap(writerXMLFile, strLoc, 0.8);
        }
        dt.Dispose();

        //画报读取
        dt = db.getDataTable("select top 5000 id from posterChannelTitle where flagID>0 order by weight DESC");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            strLoc = fullFileName + "/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm";
            addXMLSitMap(writerXMLFile, strLoc, 0.8);
        }
        dt.Dispose();

        //添加sitMap的尾,千万不能忘了这句
        writerXMLFile.WriteLine("</urlset>");
        writerXMLFile.Close();
        writerXMLFile.Dispose();

        HttpContext.Current.Response.Write("<div style=\"text-align:left;padding:50px;font-size:14px;\"><strong>" + id + " sitemap 生成成功!请分别向以下免费搜索引擎提交:</strong><br /><br />向 ask.com 提交:<a href=\"http://submissions.ask.com/ping?sitemap=http://" + HttpContext.Current.Request.Url.Host + "/sitemap.xml\" target=\"_blank\" style=\"color:red;font-size:14px;\"><strong>点击向 ask.com 提交</strong></a><br /><br />向 bing 提交:<a href=\"http://cn.bing.com/webmaster/ping.aspx?sitemap=http://" + HttpContext.Current.Request.Url.Host + "/sitemap.xml\" target=\"_blank\" style=\"color:red;font-size:14px;\"><strong>点击向 bing 提交</strong></a><br /><br />向 Google 提交:<a href=\"http://www.google.com/webmasters/\" target=\"_blank\" style=\"color:red;font-size:14px;\"><strong>点击向 google 提交</strong></a>【需要申请google帐号登录后操作】</div>");
    }
Ejemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");

        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url       = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client                  = new DefaultTopClient(url, appkey, appsecret);
        PosterChannelsGetRequest  req      = new PosterChannelsGetRequest();
        PosterChannelsGetResponse response = client.Execute(req);

        Response.Write("自动同步淘画报频道ID,如出现死机或出错,重新点击自动更新即可;<br />");
        Response.Flush();

        string strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP,@isFlag";

        string[] strValue = new string[7];

        for (int ii = 0; ii < response.Channels.Count; ii++)
        {
            strValue[0] = response.Channels[ii].Id.ToString();
            strValue[1] = response.Channels[ii].ChannelName.ToString();
            strValue[2] = response.Channels[ii].NameEn.ToString();
            if (string.IsNullOrEmpty(response.Channels[ii].Description as string))
            {
                strValue[3] = string.Empty;
            }
            else
            {
                strValue[3] = response.Channels[ii].Description;
            }
            strValue[4] = xc.adminID;
            strValue[5] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            strValue[6] = xc.GetIP();

            dt = db.getDataTable("select * from posterChannelIDs where id=" + response.Channels[ii].Id.ToString());  //防止重复插入
            if (dt.Rows.Count > 0)
            {
                strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP";
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, "id=" + response.Channels[ii].Id.ToString());
            }
            else
            {
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, string.Empty);
            }
            dt.Dispose();

            Response.Write("同步 " + strValue[1] + " [" + strValue[2] + "] " + " 已完成;<br />");
            Response.Flush();
        }
        //宝贝同步结束
    }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        PosterChannelsGetRequest req = new PosterChannelsGetRequest();
        PosterChannelsGetResponse response = client.Execute(req);

        Response.Write("自动同步淘画报频道ID,如出现死机或出错,重新点击自动更新即可;<br />");
        Response.Flush();

        string strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP,@isFlag";
        string[] strValue = new string[7];

        for (int ii = 0; ii < response.Channels.Count; ii++)
        {
            strValue[0] = response.Channels[ii].Id.ToString();
            strValue[1] = response.Channels[ii].ChannelName.ToString();
            strValue[2] = response.Channels[ii].NameEn.ToString();
            if (string.IsNullOrEmpty(response.Channels[ii].Description as string))
            {
                strValue[3] = string.Empty;
            }
            else
            {
                strValue[3] = response.Channels[ii].Description;
            }
            strValue[4] = xc.adminID;
            strValue[5] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            strValue[6] = xc.GetIP();

            dt = db.getDataTable("select * from posterChannelIDs where id=" + response.Channels[ii].Id.ToString());  //防止重复插入
            if (dt.Rows.Count > 0)
            {
                strDim = "@id,@channel_name,@name_en,@description,@postID,@postDate,@postIP";
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, "id=" + response.Channels[ii].Id.ToString());
            }
            else
            {
                db.InsertUpdateDB("posterChannelIDs", strDim, strValue, string.Empty);
            }
            dt.Dispose();

            Response.Write("同步 " + strValue[1] + " [" + strValue[2] + "] " + " 已完成;<br />");
            Response.Flush();
        }
        //宝贝同步结束
    }
Ejemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;
        string    strDim = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id";

        string[] strValue = new string[30];

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");

        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url       = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);

        Response.Write("根据分类自动同步淘宝客开始,如出现死机或出错,重新点击<a href=\"taobao.aspx\">自动更新</a>即可;<br />");
        Response.Flush();

        this.js();  //定时刷新

        //更新店铺
        DateTime t      = DateTime.Now.Date;
        string   strSql = "select top 1 * from NewsTree with(nolock) where taobaoKe <>'' and PostDate<'" + t.ToString() + "' order by newid()";

        dt = db.getDataTable(strSql); //当天不再请求更新
        if (dt.Rows.Count > 0)
        {
            string classID = dt.Rows[0]["Tid"].ToString().Trim();
            Response.Write("<br />" + dt.Rows[0]["treeNameTxt"].ToString().Trim() + " 同步完成!");
            Response.Flush();
            //System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 10));

            ItemsGetRequest req = new ItemsGetRequest();
            req.Fields     = "num_iid,title,nick,pic_url,cid,price,type,delist_time,post_fee,score,volume";
            req.Nicks      = dt.Rows[0]["taobaoKe"].ToString().Trim();
            req.PageNo     = 1L;
            req.OrderBy    = "volume";
            req.StartPrice = 50L;
            req.EndPrice   = 100000L;
            req.PageSize   = 200L;  //取最畅销前200个商品
            ItemsGetResponse response = client.Execute(req);
            long             shopNums = response.TotalResults;

            if (shopNums > 0)
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步

                for (int ii = 0; ii < response.Items.Count; ii++)
                {
                    strValue[0]  = classID;
                    strValue[1]  = response.Items[ii].NumIid.ToString();
                    strValue[2]  = response.Items[ii].Title;
                    strValue[3]  = response.Items[ii].Nick;
                    strValue[4]  = response.Items[ii].PicUrl;
                    strValue[5]  = response.Items[ii].Price;
                    strValue[6]  = @"http://item.taobao.com/item.htm?id=" + response.Items[ii].NumIid.ToString();
                    strValue[7]  = "0";
                    strValue[8]  = "0";
                    strValue[9]  = "0";
                    strValue[10] = "0";
                    strValue[11] = @"http://www.zdianpu.com";
                    strValue[12] = "0";
                    strValue[13] = "找店铺";
                    strValue[14] = response.Items[ii].Volume.ToString();
                    strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                    strValue[16] = "sys";
                    strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[18] = xc.GetIP();
                    strValue[19] = "1";
                    strValue[20] = "0";
                    strValue[21] = "0";

                    if (response.Items[ii].Title.IndexOf("邮费") < 0 || response.Items[ii].Title.IndexOf("补差") < 0)
                    {
                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + response.Items[ii].NumIid.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[6]  = dtIf.Rows[0]["click_url"].ToString().Trim();
                            strValue[7]  = dtIf.Rows[0]["commission"].ToString().Trim();
                            strValue[8]  = dtIf.Rows[0]["commission_rate"].ToString().Trim();
                            strValue[9]  = dtIf.Rows[0]["commission_num"].ToString().Trim();
                            strValue[10] = dtIf.Rows[0]["commission_volume"].ToString().Trim();
                            strValue[11] = dtIf.Rows[0]["shop_click_url"].ToString().Trim();
                            strValue[12] = dtIf.Rows[0]["seller_credit_score"].ToString().Trim();
                            strValue[13] = dtIf.Rows[0]["item_location"].ToString().Trim();
                            strValue[15] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            strValue[17] = dtIf.Rows[0]["postDate"].ToString().Trim();
                            strValue[20] = dtIf.Rows[0]["isGood"].ToString().Trim();
                            strValue[21] = dtIf.Rows[0]["poster_id"].ToString().Trim(); //淘画报

                            db.InsertUpdateDB("taobaoKe", strDim, strValue, "num_iid=" + response.Items[ii].NumIid.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }
                }
            }
            else
            {
                strValue[0] = DateTime.Now.ToString();
                db.InsertUpdateDB("NewsTree", "@PostDate", strValue, "Tid=" + classID); //更新店铺宝贝同步时出错或非淘宝客,防止死锁
            }
        }
        //宝贝同步结束

        dt.Dispose();

        //淘宝客自动更新操作
        for (int f = 0; f < 5; f++)
        {
            string id = string.Empty;

            DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
            if (tkIDs.Rows.Count > 0)
            {
                for (int i = 0; i < tkIDs.Rows.Count; i++)
                {
                    id += tkIDs.Rows[i]["num_iid"].ToString().Trim() + ",";
                }
                id = id.Substring(0, id.Length - 1);

                //锁定淘宝客更新条数
                strValue[0] = "0";
                string updateID = id.Replace(",", " or num_iid=");
                updateID = "num_iid=" + updateID;
                //Response.Write(updateID);
                //Response.End();
                db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);

                Response.Write("<br />淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString() + ",请等待10秒...");
                Response.Flush();
            }
            else
            {
                Response.Write("<br />当前淘宝客数据转换已全部完成,请明天再手动更新!");
                break;
            }
            tkIDs.Dispose();

            //Response.Write(id.ToString());

            if (!string.IsNullOrEmpty(id as string))
            {
                TaobaokeItemsConvertRequest req = new TaobaokeItemsConvertRequest();
                req.Fields  = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                req.Nick    = alimamaID;
                req.NumIids = id;
                TaobaokeItemsConvertResponse response = client.Execute(req);

                int tkCount = response.TaobaokeItems.Count; //转换后得到的淘客数量

                strDim = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                for (int i = 0; i < tkCount; i++)
                {
                    strValue[0]  = response.TaobaokeItems[i].NumIid.ToString();
                    strValue[1]  = response.TaobaokeItems[i].Title.ToString();
                    strValue[2]  = response.TaobaokeItems[i].Nick.ToString();
                    strValue[3]  = response.TaobaokeItems[i].PicUrl.ToString();
                    strValue[4]  = response.TaobaokeItems[i].Price.ToString();
                    strValue[5]  = response.TaobaokeItems[i].ClickUrl.ToString();
                    strValue[6]  = response.TaobaokeItems[i].Commission.ToString();
                    strValue[7]  = response.TaobaokeItems[i].CommissionRate;
                    strValue[8]  = response.TaobaokeItems[i].CommissionNum.ToString();
                    strValue[9]  = response.TaobaokeItems[i].CommissionVolume.ToString();
                    strValue[10] = response.TaobaokeItems[i].ShopClickUrl.ToString();
                    strValue[11] = response.TaobaokeItems[i].SellerCreditScore.ToString();
                    strValue[12] = response.TaobaokeItems[i].ItemLocation.ToString();
                    strValue[13] = response.TaobaokeItems[i].Volume.ToString();
                    strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                    strValue[15] = "1";

                    db.InsertUpdateDB("taobaoKe", strDim, strValue, " num_iid =" + response.TaobaokeItems[i].NumIid.ToString());
                }
            }
        }
    }
Ejemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        dbDataFunction db = new dbDataFunction();

        xc.CheckAdminLogin("");

        DataTable dt;

        string appkey = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppKey");
        if (string.IsNullOrEmpty(appkey as string))
        {
            Response.Redirect("../frame/otherSet.aspx", true);
        }
        string appsecret = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAppSecret");
        string url = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeUrl");
        string alimamaID = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "taobaoKeAlimamaID");    //淘宝客推广ID

        Response.Write("自动同步淘画报,如出现死机或出错,重新点击自动更新即可;<br /><br />");
        Response.Flush();

        string requestType = Request.QueryString["type"];
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        PosterPostersSearchRequest req = new PosterPostersSearchRequest();
        req.PageSize = 20L;
        req.PageNo = 1L;
        req.EditorRecommend = 1L;
        req.SortType = 4L;

        string strDim = "@id,@channel_id,@cover_pic_url_w,@cover_pic_url_h,@title,@title_short,@tag,@hits,@weight,@create_date,@modified_date,@isGood,@postID,@postIP,@postDate,@flagID";
        string[] strValue = new string[30];

        string posterId = string.Empty;
        dt = db.getDataTable("select id from posterChannelIDs where isFlag>0 order by newid()");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            //获取画报标题
            req.ChannelIds = dt.Rows[i]["id"].ToString().Trim();
            PosterPostersSearchResponse response = client.Execute(req);

            for (int ii = 0; ii < response.Posters.Count; ii++)
            {
                strValue[0] = response.Posters[ii].Id.ToString();
                //标题ID赋值
                posterId = strValue[0];
                strValue[1] = response.Posters[ii].ChannelId.ToString();
                strValue[2] = string.Empty;
                strValue[3] = string.Empty;
                string pic = response.Posters[ii].CoverPicUrl.ToString();
                if (!string.IsNullOrEmpty(pic as string))
                {
                    string[] img = pic.Split(new char[] { ',' });
                    strValue[2] = img[0];
                    strValue[3] = img[img.GetUpperBound(0)];
                }
                strValue[4] = response.Posters[ii].Title;
                strValue[5] = response.Posters[ii].TitleShort;
                strValue[6] = response.Posters[ii].Tag;
                strValue[7] = response.Posters[ii].Hits.ToString();
                strValue[8] = response.Posters[ii].Weight.ToString();
                strValue[9] = response.Posters[ii].CreateDate.ToString();
                strValue[10] = response.Posters[ii].ModifiedDate.ToString();
                strValue[11] = "0";
                strValue[12] = xc.adminID;
                strValue[13] = xc.GetIP();
                strValue[14] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                strValue[15] = "1"; //默认正常

                DataTable dtIF = db.getDataTable("select * from posterChannelTitle where id=" + posterId);  //防止重复插入
                if (dtIF.Rows.Count > 0)
                {
                    strValue[8] = dtIF.Rows[0]["weight"].ToString().Trim();
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, "id=" + posterId);
                }
                else
                {
                    db.InsertUpdateDB("posterChannelTitle", strDim, strValue, string.Empty);
                }
                dtIF.Dispose();

                Response.Write("<br />同步 " + strValue[4] + " 已完成;<br />");
                Response.Flush();

                //获取关联商品
                PosterPostauctionsGetRequest poster = new PosterPostauctionsGetRequest();
                poster.PosterId = long.Parse(posterId);
                PosterPostauctionsGetResponse rsp = client.Execute(poster);
                int c = rsp.Posterauctions.Count;
                if (c > 9)
                {
                    string strDim2 = "@classID,@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@postID,@postDate,@postIP,@isBad,@isGood,@poster_id,@auction_short_title";
                    for (int s = 0; s < c; s++)
                    {
                        strValue[0] = "0";
                        strValue[1] = rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[2] = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                        strValue[3] = "找店铺 ZdianPU.com";
                        strValue[4] = "/images/WaterMark.png";
                        strValue[5] = rsp.Posterauctions[s].AuctionPrice.ToString();
                        strValue[6] = @"http://item.taobao.com/item.htm?id=" + rsp.Posterauctions[s].AuctionId.ToString();
                        strValue[7] = "0";
                        strValue[8] = "0";
                        strValue[9] = "0";
                        strValue[10] = "0";
                        strValue[11] = @"http://www.zdianpu.com";
                        strValue[12] = "0";
                        strValue[13] = "找店铺";
                        strValue[14] = "0";
                        strValue[15] = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd HH:mm:ss");   //表示已过期
                        strValue[16] = xc.adminID;
                        strValue[17] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        strValue[18] = xc.GetIP();
                        strValue[19] = "1";
                        strValue[20] = "0";
                        strValue[21] = rsp.Posterauctions[s].PosterId.ToString();
                        strValue[22] = rsp.Posterauctions[s].AuctionShortTitle.ToString();

                        DataTable dtIf = db.getDataTable("select * from taobaoKe with(nolock) where num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());  //防止重复插入
                        if (dtIf.Rows.Count > 0)
                        {
                            strValue[0] = rsp.Posterauctions[s].PosterId.ToString();
                            strValue[1] = rsp.Posterauctions[s].AuctionShortTitle.ToString();
                            db.InsertUpdateDB("taobaoKe", "@poster_id,@auction_short_title", strValue, "num_iid=" + rsp.Posterauctions[s].AuctionId.ToString());
                        }
                        else
                        {
                            db.InsertUpdateDB("taobaoKe", strDim2, strValue, string.Empty);
                        }
                        dtIf.Dispose();
                    }

                    //淘宝客自动更新操作
                    for (int f = 0; f < 100; f++)
                    {
                        string id = string.Empty;

                        DataTable tkIDs = db.getDataTable("select top 40 num_iid from taobaoKe where poster_id=" + posterId + " and isBad>0 and updateDate<GETDATE() order by updateDate ASC");    //30天过期内的数据可再次更新
                        if (tkIDs.Rows.Count > 0)
                        {
                            Response.Write("淘宝客数据转换已完成 " + ((f * 40) + tkIDs.Rows.Count).ToString() + "<br />");
                            Response.Flush();

                            for (int t = 0; t < tkIDs.Rows.Count; t++)
                            {
                                id += tkIDs.Rows[t]["num_iid"].ToString().Trim() + ",";
                            }
                            id = id.Substring(0, id.Length - 1);

                            //锁定淘宝客更新条数
                            strValue[0] = "0";
                            string updateID = id.Replace(",", " or num_iid=");
                            updateID = "num_iid=" + updateID;
                            //Response.Write(updateID);
                            //Response.End();
                            db.InsertUpdateDB("taobaoKe", "@isBad", strValue, updateID);
                        }
                        else
                        {
                            break;
                        }
                        tkIDs.Dispose();

                        //Response.Write(id.ToString());

                        if (!string.IsNullOrEmpty(id as string))
                        {
                            TaobaokeItemsConvertRequest reqTk = new TaobaokeItemsConvertRequest();
                            reqTk.Fields = "num_iid,title,nick,pic_url,price,click_url,commission,commission_rate,commission_num,commission_volume,shop_click_url,seller_credit_score,item_location,volume";
                            reqTk.Nick = alimamaID;
                            reqTk.NumIids = id;
                            TaobaokeItemsConvertResponse responseTk = client.Execute(reqTk);

                            int tkCount = responseTk.TaobaokeItems.Count; //转换后得到的淘客数量

                            string strDim3 = "@num_iid,@title,@nick,@pic_url,@price,@click_url,@commission,@commission_rate,@commission_num,@commission_volume,@shop_click_url,@seller_credit_score,@item_location,@volume,@updateDate,@isBad";

                            for (int tk = 0; tk < tkCount; tk++)
                            {
                                strValue[0] = responseTk.TaobaokeItems[tk].NumIid.ToString();
                                strValue[1] = responseTk.TaobaokeItems[tk].Title.ToString();
                                strValue[2] = responseTk.TaobaokeItems[tk].Nick.ToString();
                                strValue[3] = responseTk.TaobaokeItems[tk].PicUrl.ToString();
                                strValue[4] = responseTk.TaobaokeItems[tk].Price.ToString();
                                strValue[5] = responseTk.TaobaokeItems[tk].ClickUrl.ToString();
                                strValue[6] = responseTk.TaobaokeItems[tk].Commission.ToString();
                                strValue[7] = responseTk.TaobaokeItems[tk].CommissionRate;
                                strValue[8] = responseTk.TaobaokeItems[tk].CommissionNum.ToString();
                                strValue[9] = responseTk.TaobaokeItems[tk].CommissionVolume.ToString();
                                strValue[10] = responseTk.TaobaokeItems[tk].ShopClickUrl.ToString();
                                strValue[11] = responseTk.TaobaokeItems[tk].SellerCreditScore.ToString();
                                strValue[12] = responseTk.TaobaokeItems[tk].ItemLocation.ToString();
                                strValue[13] = responseTk.TaobaokeItems[tk].Volume.ToString();
                                strValue[14] = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");
                                strValue[15] = "1";

                                db.InsertUpdateDB("taobaoKe", strDim3, strValue, " num_iid =" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                //更新商品一对多关联表
                                DataTable dtIf = db.getDataTable("select * from posterTkID with(nolock) where title_id=" + posterId + " and tK_num_iid=" + responseTk.TaobaokeItems[tk].NumIid.ToString());
                                if (dtIf.Rows.Count < 1)  //防止重复插入
                                {
                                    strValue[0] = posterId;
                                    strValue[1] = responseTk.TaobaokeItems[tk].NumIid.ToString();

                                    db.InsertUpdateDB("posterTkID", "@title_id,@tK_num_iid", strValue, "");
                                }
                                dtIf.Dispose();
                            }
                        }
                    }
                }
                else
                {
                    db.DelDB("posterChannelTitle", "id", response.Posters[ii].Id.ToString(), "", false, "");
                }
            }
        }
        dt.Dispose();
    }
Ejemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom      xc     = new XabaraCom();
        dbDataFunction db     = new dbDataFunction();
        xabaraAD       ad     = new xabaraAD();
        XabaraClass    xClass = new XabaraClass();
        webPublic      wp     = new webPublic();

        this.Page.Title = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "titleMeta");

        if (!IsPostBack)
        {
            DataTable dt;
            dt = db.getDataTable("select top 5 Tid,TreeName from NewsTree where taobaoKe<>'' order by newid() ");
            for (int i = 0; i < 5; i++)
            {
                ppRnd.Text += "<a href=\"/" + dt.Rows[i]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + dt.Rows[i]["TreeName"].ToString().Trim() + "\">" + dt.Rows[i]["TreeName"].ToString().Trim() + "</a>";
                if (i < 4)
                {
                    ppRnd.Text += "&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
            }
            dt.Dispose();

            ad468.Text = ad.getAdCode(0, 468, 60, 1, 0, true, string.Empty);
            long adID = 116;

            vipCode.Text = "<div class=\"divWidth\"><a href=\"/278.htm\" target=\"_blank\"><img src=\"/ad/images/okitch_20120630.gif\" /></a></div><div class=\"height5px\"></div>";

            //淘画报
            dt = db.getDataTable("select top 5 id,title,title_short,cover_pic_url_h,cover_pic_url_w from posterChannelTitle where flagID>0 and weight>10000 and modified_date>'" + DateTime.Now.AddDays(-7) + "' order by newid()");
            if (dt.Rows.Count > 4)
            {
                HuaBaoLeft.Text = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;\"><tr>";
                string txtLink = string.Empty;
                for (int i = 0; i < 3; i++)
                {
                    HuaBaoLeft.Text += "<td style=\"text-align:center; width:190px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\"><img src=\"" + dt.Rows[i]["cover_pic_url_h"].ToString().Trim() + "\" class=\"picHuaBaoH\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title_short"].ToString().Trim() + "\" id=\"imghbh\" /></a></td>";

                    txtLink += "<td style=\"text-align:center; height:28px; line-height:28px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\" class=\"huabao\">" + dt.Rows[i]["title_short"].ToString().Trim() + "</a></td>";
                }
                HuaBaoLeft.Text += "</tr><tr>" + txtLink + "</tr></table>";

                HuaBaoRight.Text = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;\"><tr>";
                txtLink          = string.Empty;
                for (int i = 3; i < 5; i++)
                {
                    HuaBaoRight.Text += "<td style=\"text-align:center; width:190px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\"><img src=\"" + dt.Rows[i]["cover_pic_url_w"].ToString().Trim() + "\" class=\"picHuaBaoW\" alt=\"" + dt.Rows[i]["title"].ToString().Trim() + "\" title=\"" + dt.Rows[i]["title_short"].ToString().Trim() + "\" id=\"imghbw\" /></a></td>";

                    txtLink += "<td style=\"text-align:center; height:32px; line-height:32px;\"><a href=\"/huabao/show/" + dt.Rows[i]["id"].ToString().Trim() + ".htm\" target=\"_blank\" class=\"huabao\">" + dt.Rows[i]["title_short"].ToString().Trim() + "</a></td>";
                }
                HuaBaoRight.Text += "</tr><tr>" + txtLink + "</tr><tr><td colspan=\"2\" style=\"padding-top:5px;\"><table align=\"center\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px;width:98%;\"><tr><td style=\"text-align:left;\">" + ad.getAdCode(335, 0, 0, 3, 1, true, "") + "</td><td style=\"text-align:right;\">" + ad.getAdCode(334, 0, 0, 1, 0, true, "") + "</td></tr></table></td></tr></table>";
            }
            else
            {
                huabao.Visible = false;
            }
            dt.Dispose();

            //导航及产品
            headMenu.Text = "<td valign=\"middle\" class=\"headBg2\"><a href=\"/\" target=\"_top\" class=\"head\">网站首页</a></td>";
            dt            = db.getDataTable("select Tid,TreeName from newsTree where TreeID=0 and TreeType='taobaoke' order by ListID ASC,Tid ASC");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tid      = dt.Rows[i]["Tid"].ToString().Trim();
                string treeName = dt.Rows[i]["TreeName"].ToString().Trim();

                //广告代码
                adID += 1;
                string adCodeWidth = ad.getAdCode(adID, 0, 0, 1, 1, true, "");
                int    shopNums    = 12; //每个版块读取商品数
                if (!string.IsNullOrEmpty(adCodeWidth as string))
                {
                    adCodeWidth = "<div class=\"divWidth\">" + adCodeWidth + "</div>";
                }
                string adCodeHeight = ad.getAdCode(adID + 8, 0, 0, 1, 1, true, "");
                if (string.IsNullOrEmpty(adCodeHeight as string))
                {
                    DataTable ppDt = db.getDataTable("select top 22 Tid,TreeName from NewsTree where taobaoKe<>'' and idLayerStr like '%|" + tid + "|%' order by listID ASC,Tid ASC ");
                    if (ppDt.Rows.Count > 0)
                    {
                        adCodeHeight = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%;\" align=\"center\" class=\"indexTable\">";
                        for (int p = 0; p < ppDt.Rows.Count; p++)
                        {
                            adCodeHeight += "<tr><td><a href=\"/" + ppDt.Rows[p]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + ppDt.Rows[p]["TreeName"].ToString().Trim() + "\" alt=\"查看 " + ppDt.Rows[p]["TreeName"].ToString().Trim() + "\" class=\"classID\">" + ppDt.Rows[p]["TreeName"].ToString().Trim() + "</a></td></tr>";
                        }
                        adCodeHeight += "<tr><td style=\"text-align:right;\"><a href=\"/" + tid + ".htm\" target=\"_blank\" title=\"更多 " + treeName + " 品牌\" alt=\"更多 " + treeName + " 品牌\" class=\"classID\">>> 更多品牌</a></td></tr></table>";
                    }
                    ppDt.Dispose();
                }
                else
                {
                    shopNums = 12;
                }

                //商品读取
                string shopHtm = string.Empty;
                string ifStr   = string.Empty;
                string cidStr  = xClass.getClassAllID("taobaoke", xc.SafeNum(tid)); //得到所有ID
                if (cidStr.IndexOf(",") > 0)
                {
                    string[] ids     = cidStr.Split(new char[] { ',' });
                    int      iiCount = ids.GetUpperBound(0);
                    int      readTop = 1;
                    if (shopNums > iiCount - 5)
                    {
                        readTop = 2;
                    }

                    for (int ii = 0; ii <= iiCount; ii++)
                    {
                        ifStr += " select top " + readTop.ToString() + " num_iid,title,pic_url,click_url,commission,price,volume from taobaoke where isBad>0 and isGood>0 and classID=" + ids[ii].ToString().Trim() + " order by volume DESC union ";
                    }
                }
                else
                {
                    ifStr = " select num_iid,title,pic_url,click_url,commission,price,volume from taobaoke where isBad>0 and isGood>0 and classID=" + tid + " union ";
                }
                ifStr = "(" + ifStr.Substring(0, ifStr.Length - 6) + ") as news";

                string    strSql = "select top " + shopNums.ToString() + " * from " + ifStr + " Order By newid()";
                DataTable dtShop = db.getDataTable(strSql);
                //Response.Write(strSql);
                //Response.End();
                shopHtm = string.Empty;
                for (int s = 0; s < dtShop.Rows.Count; s++)
                {
                    shopHtm += "<td valign=\"top\" style=\"border-style: none solid solid none; border-width: 1px; border-color: #323232; text-align:center; width:200px;\"><a class=\"moneyLink\" href=\"/show/" + dtShop.Rows[s]["num_iid"].ToString().Trim() + ".htm\" target=\"_blank\" alt=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" title=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\"><div style=\"position:absolute;\"><ul><li style=\"height:168px;\"></li><li class=\"moneyFont\" style=\"background-color:#323232; filter:Alpha(opacity=30);opacity:0.3; text-align:right; padding:5px; width:190px; color:#b8b8b8;\">" + xc.getMoney(dtShop.Rows[s]["price"].ToString().Trim()) + "</li></ul></div><img id=\"imgshow\" src=\"" + dtShop.Rows[s]["pic_url"].ToString().Trim() + "_310x310.jpg\" style=\"height:200px; width:200px;\" alt=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" title=\"" + dtShop.Rows[s]["title"].ToString().Trim() + "\" /></a></td>";

                    if (s == 3 || s == 7)
                    {
                        shopHtm += "</tr><tr>";
                    }
                }
                dtShop.Dispose();

                headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/" + tid + ".htm\" target=\"_top\" class=\"head\">" + treeName + "</a></td>";
                //产品二级分类
                string    class2  = "<span class=\"headLine\">|</span>&nbsp;";
                DataTable dtClass = db.getDataTable("select Tid,TreeName from newsTree where TreeID=" + tid + " and TreeType='taobaoke' order by ListID ASC,Tid ASC");
                for (int c = 0; c < dtClass.Rows.Count; c++)
                {
                    string classID   = dtClass.Rows[c]["Tid"].ToString().Trim();
                    string className = dtClass.Rows[c]["TreeName"].ToString().Trim();
                    class2 += "<a href=\"/" + dtClass.Rows[c]["Tid"].ToString().Trim() + ".htm\" target=\"_blank\" title=\"查看 " + className + "\" alt=\"查看 " + className + "\">" + className + "</a>&nbsp;<span class=\"headLine\">|</span>&nbsp;";
                }
                dtClass.Dispose();

                shopList.Text += adCodeWidth;
                shopList.Text += "<div class=\"height5px\"></div>";
                shopList.Text += "<div class=\"divWidth\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:0px; border-collapse:collapse; height:26px; width:100%;\"><tr><td style=\"width:125px; text-align:left;\"><img src=\"images/class" + tid + ".gif\" alt=\"" + treeName + "\" title=\"" + treeName + "\" /></td><td style=\"text-align:right; vertical-align:bottom; width:807px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\">" + class2 + "</td><td style=\"text-align:right; vertical-align:bottom; width:38px;\"><a href=\"/" + tid + ".htm\" target=\"_top\"><img src=\"images/more.gif\" alt=\"更多 " + treeName + "\" title=\"更多 " + treeName + "\" /></a></td></tr></table></div>";
                shopList.Text += "<div class=\"divWidth\" style=\"height:2px; background-color:Black; font-size:0px;\"></div>";
                shopList.Text += "<div class=\"divWidth\"><table cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\" style=\"background-color:#323232; width:166px; text-align:center;\" rowspan=\"3\">" + adCodeHeight + "</td>" + shopHtm + "</tr></table></div>";
            }
            headMenu.Text += "<td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/default.htm\" target=\"_top\" class=\"head\">图搜画报</a></td><td valign=\"middle\" class=\"headBg1\"><a href=\"/huabao/\" target=\"_top\" class=\"head\">画报淘宝</a></td>";
            dt.Dispose();

            //热搜关键词
            string   hot     = XmlReader.GetConfig(HttpContext.Current.Server.MapPath("~/xabara.config"), "hotSearch");
            string[] hotWord = hot.Split(new char[] { ',' });
            for (int h = 0; h <= hotWord.GetUpperBound(0); h++)
            {
                hotSearch.Text += "<a href=\"/search.htm?keyWord=" + Server.UrlEncode(hotWord[h]) + "\" target=\"_top\" title=\"搜索 " + hotWord[h] + "\">" + hotWord[h] + "</a>&nbsp;";
            }

            this.Page.MetaKeywords    = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "KeyWord");
            this.Page.MetaDescription = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "metaStr");
        }
    }