Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|" + typeClss + "|");
        if (!IsPostBack)
        {
            XabaraClass xClass = new XabaraClass();
            xClass.NewsTypeData(typeClss, DropDownListClass);
            if (!string.IsNullOrEmpty(Session[typeClss] as string))
            {
                this.DropDownListClass.Items.FindByValue(Session[typeClss].ToString().Trim()).Selected = true;
            }
            else
            {
                this.DropDownListClass.Items.FindByText("== 新增根分类 ==").Selected = true;
            }
            xClass.getTreeList(typeClss, treeList, string.Empty, "top", false, true, false);

            FormCheck fCheck = new FormCheck();
            classListRegExpre.ValidationExpression = fCheck.RegExpressionValidator("number", 0, 0, false);
            classListRegExpre.ErrorMessage         = fCheck.RegExpressionValidator("number", 0, 0, true);
            classUrlRegExpre.ValidationExpression  = fCheck.RegExpressionValidator("urlHttp", 0, 0, false);
            classUrlRegExpre.ErrorMessage          = fCheck.RegExpressionValidator("urlHttp", 0, 0, true);

            titleClass.Text = Server.UrlDecode(xc.SafeSql(Request["title"]));
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|" + typeClss + "|");
        if (!IsPostBack)
        {
            xClass.NewsTypeData(typeClss, DropDownListClass);
            classListName.Visible = true;
            classListName.Text    = "如需排序,请选择带有子级分类的父分类并点击 显示所选分类排序 按钮!";
            xClass.getTreeList(typeClss, treeList, string.Empty, "top", false, true, false);

            titleClass.Text = Server.UrlDecode(titleTemp);

            DataTable dt = db.getDataTable("select Tid from newsTree where treeNameTxt is null");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                long cid = xc.SafeNum(dt.Rows[i]["Tid"].ToString().Trim());
                xClass.treeNameUpdate(cid);
                xClass.updateIDs(typeClss, cid);
            }
            dt.Dispose();

            FormCheck fCheck = new FormCheck();
            classUrlRegExpre.ValidationExpression = fCheck.RegExpressionValidator("urlHttp", 0, 0, false);
            classUrlRegExpre.ErrorMessage         = fCheck.RegExpressionValidator("urlHttp", 0, 0, true);
        }
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|adsAdd|");

        if (!IsPostBack)
        {
            FormCheck fCheck = new FormCheck();
            pdateRegExpree.ValidationExpression = fCheck.RegExpressionValidator("dateTime", 0, 0, false);
            pdateRegExpree.ErrorMessage         = fCheck.RegExpressionValidator("dateTime", 0, 0, true);
            eDateRegExpree.ValidationExpression = fCheck.RegExpressionValidator("dateTime", 0, 0, false);
            eDateRegExpree.ErrorMessage         = fCheck.RegExpressionValidator("dateTime", 0, 0, true);
            httpRegExpree.ValidationExpression  = fCheck.RegExpressionValidator("urlHttp", 0, 0, false);
            httpRegExpree.ErrorMessage          = fCheck.RegExpressionValidator("urlHttp", 0, 0, true);
            wRegExpree.ValidationExpression     = fCheck.RegExpressionValidator("number", 0, 0, false);
            wRegExpree.ErrorMessage             = "宽度" + fCheck.RegExpressionValidator("number", 0, 0, true);
            hRegExpree.ValidationExpression     = fCheck.RegExpressionValidator("number", 0, 0, false);
            hRegExpree.ErrorMessage             = "高度" + fCheck.RegExpressionValidator("number", 0, 0, true);

            DateTime nStr = DateTime.Now;
            pDate.Text = nStr.ToString("yyyy-MM-dd HH:mm:ss");
            eDate.Text = nStr.AddYears(1).ToString("yyyy-MM-dd HH:mm:ss");

            XabaraClass xClass = new XabaraClass();
            xClass.NewsTypeData("ads", adClass);

            this.adImg.Items.Add(new ListItem("图片:" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadImgType"), "Img"));
            this.adImg.Items.Add(new ListItem("Flash:" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadFlashType"), "Flash"));
            this.adImg.Items.Add(new ListItem("广告代码", "Code"));
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        xc.CheckAdminLogin("");

        if (!IsPostBack)
        {
            this.CreateUserPage("http://" + Request.Url.Host + "/default.aspx");
        }
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("");

        if (!IsPostBack)
        {
            this.CreateUserPage("http://" + Request.Url.Host + "/default.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|adminExe|");

        if (!IsPostBack)
        {
            string    strSqlread = "select UserID,UserName,UserAdmin from AdminUser where userID='" + xc.SafeSql(Request["id"].Trim()) + "'";
            DataTable dtRead     = db.getDataTable(strSqlread);
            if (dtRead.Rows.Count > 0 && xc.SafeSql(Request["id"].Trim()) != xc.adminID)
            {
                if (dtRead.Rows[0]["UserAdmin"].ToString().Trim().Equals("xabaraCOM"))
                {
                    xc.divError("", dtRead.Rows[0]["UserID"].ToString().Trim() + " 已是超级管理员,不需设置相应权限!", 380, 150, "userList.aspx", "goto");
                }
                string userAdminStr = dtRead.Rows[0]["UserAdmin"].ToString();

                uid.Text = dtRead.Rows[0]["UserName"].ToString() + "[" + dtRead.Rows[0]["UserID"].ToString() + "]";
                DataTable dt;

                dt = db.getDataTable("select * from classAdmin order by listID ASC ");
                if (dt.Rows.Count > 0)
                {
                    string ifType  = string.Empty;
                    string bgColor = string.Empty;
                    selectPopedomHtm.Text = "<table border='0' align='left' class='tableAdminLine'><tr>";
                    for (int p = 0; p < dt.Rows.Count; p++)
                    {
                        if (!ifType.Equals(dt.Rows[p]["listClass"].ToString().Trim()) && p > 0)  //控制回车
                        {
                            selectPopedomHtm.Text += "</tr><tr>";
                        }
                        ifType = dt.Rows[p]["listClass"].ToString().Trim();

                        string selectValue = dt.Rows[p]["classCode"].ToString().Trim();
                        string selectBool  = string.Empty;
                        if (userAdminStr.IndexOf(@"|" + selectValue + "|") >= 0)
                        {
                            selectBool = @" checked='checked'";
                        }

                        selectPopedomHtm.Text += "<td style='background-color:#f5fdfe;'><input name='adminPopedomSelect' type='checkbox' id='adminPopedomSelect' value='" + selectValue + "'" + selectBool + " />" + dt.Rows[p]["className"].ToString().Trim() + "</td>";
                    }
                    selectPopedomHtm.Text += "</tr></table>";
                }
                dt.Dispose();
            }
            else
            {
                xc.divError("", "您的操作有误!", 350, 150, "userList.aspx", "goto");
            }
            dtRead.Dispose();
        }
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("");

        if (!IsPostBack)
        {
            ad.Text     = "<iframe src=\"http://" + Request.Url.Host + "/ad/?size=300\" scrolling=\"no\" frameborder=\"0\" height=\"300px\" width=\"300px\" marginheight=\"0px\" marginwidth=\"0px\"></iframe>";
            adView.Text = ad.Text;
        }
    }
Exemple #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        if (!IsPostBack)
        {
            flag.Items.Add(new ListItem("图片:" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadImgType"), "Img"));
            flag.Items.Add(new ListItem("文件:" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadFileType"), "File"));
            flag.Items.Add(new ListItem("Flash:" + XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadFlashType"), "Flash"));
            this.indexPicSet.Items.Add(new ListItem("== 上传图片后可选择其中一张作为首页面的预览图 ==", string.Empty));
            string upImgTemp = string.Empty;

            int imgCount = 0;
            if (xc.SafeSql(Request["postType"]).Equals("edit")) //修改信息
            {
                string    strSql = "select fileName from upFileName where fileFlag='Img' and fileID='" + Session["upFileID"].ToString() + "' order by Fid ASC ";
                DataTable dt     = db.getDataTable(strSql);

                this.indexPicSet.Items.Clear();

                imgCount = dt.Rows.Count;

                if (imgCount > 0)
                {
                    this.indexPicSet.Items.Add(new ListItem("== 选择或取消页面预览图 ==", string.Empty));
                }

                if (imgCount == 0)
                {
                    this.indexPicSet.Items.Add(new ListItem("== 上传图片后可选择其中一张作为首页面的预览图 ==", string.Empty));
                }

                for (int i = 0; i < imgCount; i++)
                {
                    string fileNameStr = dt.Rows[i]["fileName"].ToString().Trim();
                    this.indexPicSet.Items.Add(new ListItem(fileNameStr, fileNameStr));
                }
                this.indexPicSet.DataBind();
            }

            if (!String.IsNullOrEmpty(Session["upPreFile"] as string) && imgCount > 0)
            {
                upImgTemp = Session["upPreFile"].ToString().Trim();

                this.indexPicSet.Items.FindByText(upImgTemp).Selected  = true;
                this.indexPicSet.Items.FindByValue(upImgTemp).Selected = true;

                preImage.Visible  = true;   //预览图
                preImage.ImageUrl = xc.UploadFolder.ToString() + upImgTemp.Substring(5, 8) + "/" + upImgTemp;
            }
        }
    }
Exemple #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        if (!IsPostBack)
        {
            xClass.NewsTypeData("taobaoke", classID);
            object selectClass = Session["shopClass"];
            if (!string.IsNullOrEmpty(selectClass as string))
            {
                this.classID.Items.FindByValue(selectClass.ToString().Trim()).Selected = true;
            }
        }
    }
Exemple #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("xabaraCOM");

        if (!IsPostBack)
        {
            myCode.Text = xc.regUserCode();

            EncryptDecrypt ed       = new EncryptDecrypt();
            string         soft     = ed.softName();
            string[]       softName = soft.Split(new char[] { '_' });
            soft = softName[0];
            softLink.NavigateUrl = "http://www.zdianpu.com/soft/" + soft + "/server.aspx";
        }
    }
Exemple #11
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");
    }
Exemple #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|adminAdd|");
        if (!IsPostBack)
        {
            new XabaraClass().NewsTypeData("department", adminClass);

            FormCheck fCheck = new FormCheck();
            adminIDRegularExpressionValidator.ValidationExpression   = fCheck.RegExpressionValidator("userID", 3, 20, false);
            adminIDRegularExpressionValidator.ErrorMessage           = fCheck.RegExpressionValidator("userID", 3, 20, true);
            adminNameRegularExpressionValidator.ValidationExpression = fCheck.RegExpressionValidator("chinese", 0, 0, false);
            adminNameRegularExpressionValidator.ErrorMessage         = fCheck.RegExpressionValidator("chinese", 0, 0, true);
            adminPWRegularExpressionValidator.ValidationExpression   = fCheck.RegExpressionValidator("passWord", 8, 20, false);
            adminPWRegularExpressionValidator.ErrorMessage           = fCheck.RegExpressionValidator("passWord", 8, 20, true);
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();
        xc.CheckAdminLogin(string.Empty);
        Page.Title = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + " 管理系统";

        if (!IsPostBack)
        {
            LgName.Text = HttpUtility.UrlDecode(Request.Cookies["XabaraAdmin"]["AdminName"].Trim()) + "[" + xc.adminID + "]";
            lgNum.Text = Request.Cookies["XabaraAdmin"]["AdminLgNums"].ToString().Trim();

            timeJS.Text = xc.getDataTime(1, 1, 0);
            qqLink.Text = xc.QQHTM("839808029", "41");
            SoftVer.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + " " + xc.XabaraVer.ToString().Trim();
        }
    }
Exemple #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin(string.Empty);
        Page.Title = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + " 管理系统";

        if (!IsPostBack)
        {
            LgName.Text = HttpUtility.UrlDecode(Request.Cookies["XabaraAdmin"]["AdminName"].Trim()) + "[" + xc.adminID + "]";
            lgNum.Text  = Request.Cookies["XabaraAdmin"]["AdminLgNums"].ToString().Trim();

            timeJS.Text  = xc.getDataTime(1, 1, 0);
            qqLink.Text  = xc.QQHTM("839808029", "41");
            SoftVer.Text = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "webName") + " " + xc.XabaraVer.ToString().Trim();
        }
    }
Exemple #15
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");
    }
Exemple #16
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");
        }
    }
Exemple #17
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");
        }
    }
Exemple #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        long   cidTemp    = xc.SafeNum(Request["cid"]);
        string strSql     = string.Empty;
        string ifStr      = string.Empty;
        string keyWordStr = xc.SafeSql(Server.UrlDecode(Request["keyWords"]));

        if (!IsPostBack)
        {
            xClass.NewsTypeData("department", classList);

            if (cidTemp > 0) //分类读取
            {
                string idNums = xClass.getClassAllID("department", cidTemp);

                if (!idNums.Equals(cidTemp.ToString()))
                {
                    string[] ids = idNums.Split(new char[] { ',' });
                    for (int i = 0; i <= ids.GetUpperBound(0); i++)
                    {
                        ifStr += "classID=" + ids[i].ToString().Trim() + " or ";
                    }
                    ifStr = " and (" + ifStr.Substring(0, ifStr.Length - 3) + ")";
                }
                else
                {
                    ifStr += " and classID=" + cidTemp.ToString().Trim();
                }
                this.classList.Items.FindByValue(cidTemp.ToString()).Selected = true;
            }
            if (!string.IsNullOrEmpty(keyWordStr as string))
            {
                ifStr       += " and (UserName like '%" + keyWordStr + "%' or UserId like '%" + keyWordStr + "%') ";
                keyWord.Text = keyWordStr;
            }
            strSql = "select * from AdminUser where classID>0 " + ifStr + " Order By LoginDate desc";
            //Response.Write(strSql);

            lblCurrentPage.Text = new dbDataFunction().RepeaterDB(RepeaterList, strSql, "&keyWords=" + keyWordStr, 20, "page", "center", true);
        }
    }
Exemple #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("xabaraCOM");
        if (!IsPostBack)
        {
            FormCheck fc = new FormCheck();
            emailRegularExpressionValidator.ValidationExpression  = fc.RegExpressionValidator("email", 0, 0, false);
            emailRegularExpressionValidator.ErrorMessage          = fc.RegExpressionValidator("email", 0, 0, true);
            telRegularExpressionValidator.ValidationExpression    = fc.RegExpressionValidator("phone", 0, 0, false);
            telRegularExpressionValidator.ErrorMessage            = fc.RegExpressionValidator("phone", 0, 0, true);
            faxRegularExpressionValidator.ValidationExpression    = fc.RegExpressionValidator("phone", 0, 0, false);
            faxRegularExpressionValidator.ErrorMessage            = fc.RegExpressionValidator("phone", 0, 0, true);
            mobileRegularExpressionValidator.ValidationExpression = fc.RegExpressionValidator("mobile", 0, 0, false);
            mobileRegularExpressionValidator.ErrorMessage         = fc.RegExpressionValidator("mobile", 0, 0, true);
            urlRegExpress.ValidationExpression = fc.RegExpressionValidator("url", 0, 0, false);
            urlRegExpress.ErrorMessage         = fc.RegExpressionValidator("url", 0, 0, true);

            string      pathFlie = HttpContext.Current.Server.MapPath("/xabara.config");
            XmlDocument xmlDoc   = new XmlDocument();
            xmlDoc.Load(pathFlie);

            webName.Text    = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='webName']").Attributes["value"].Value;
            webDomains.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='webDomains']").Attributes["value"].Value;
            webBak.Text     = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='miibeian']").Attributes["value"].Value;
            webQQ.Text      = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='qq']").Attributes["value"].Value;
            wangwang.Text   = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobao']").Attributes["value"].Value;
            webEmail.Text   = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='webEmail']").Attributes["value"].Value;
            webtel.Text     = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='webTel']").Attributes["value"].Value;
            webFax.Text     = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='webFax']").Attributes["value"].Value;
            webMobile.Text  = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='mobile']").Attributes["value"].Value;
            freePhone.Text  = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='freePhone']").Attributes["value"].Value;
            ips.Text        = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='ip']").Attributes["value"].Value;
            waterWords.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='waterMark']").Attributes["value"].Value;
            keyWords.Text   = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='KeyWord']").Attributes["value"].Value;
            mKeyWords.Text  = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='metaStr']").Attributes["value"].Value;
            titleMeta.Text  = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='titleMeta']").Attributes["value"].Value;
            countStr.Text   = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='countScript']").Attributes["value"].Value;

            ipAdd.Text = xc.GetIP();
        }
    }
Exemple #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("|adminPW|");

        string idTemp = xc.SafeNum(Request["id"].Trim()).ToString();
        string dimStr = "@UserPW";
        string[] strValue = new string[1];
        string strVlaueTemp = xc.GetRnd("abc", 1) + xc.GetRnd("abc123", 7).ToLower();
        strValue[0] = xc.GetMd5(strVlaueTemp).ToString();

        if (new dbDataFunction().InsertUpdateDB("AdminUser", dimStr, strValue, "Uid=" + idTemp + " and UserId<>'" + xc.adminID + "'").Equals("更新成功"))
        {
            xc.insertMyLog(xc.adminID, "admin", "管理员密码初始化");
            xc.divError("", "新密码:" + strVlaueTemp, 350, 150, "userList.aspx", "goto");
        }
        else
        {
            xc.divError("", "不能给自己密码初始化或操作错误!", 350, 150, "userList.aspx", "goto");
        }
    }
Exemple #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        string uID     = xc.SafeSql(Request["id"]).Trim();
        string ifStr   = string.Empty;
        string pageStr = string.Empty;

        if (!uID.Equals("a"))
        {
            ifStr = " and userCardID='" + uID + "'";
        }
        else
        {
            //ifStr = " and userID<>'xabara'";
            pageStr = "&id=a";
        }

        string strSql = "select * from logLogin where userType='admin' " + ifStr + " order by id DESC";

        lblCurrentPage.Text = new dbDataFunction().RepeaterDB(RepeaterList, strSql, pageStr, 20, "page", "center", true);
    }
Exemple #22
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("更新全站缓存完成!");
    }
Exemple #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("xabaraCOM");
        if (!IsPostBack)
        {
            EncryptDecrypt ed = new EncryptDecrypt();
            soft = ed.softName();
            string[] softName = soft.Split(new char[] { '_' });
            soft = softName[0];

            string      pathFlie = Server.MapPath("/xabara.config");
            XmlDocument xmlDoc   = new XmlDocument();
            xmlDoc.Load(pathFlie);

            taobaoKeAppKey.Text    = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAppKey']").Attributes["value"].Value;
            taobaoKeAppSecret.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAppSecret']").Attributes["value"].Value;
            taobaoKeAlimamaID.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAlimamaID']").Attributes["value"].Value;
            hotSearch.Text         = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='hotSearch']").Attributes["value"].Value;

            xmlDoc = null;
        }
    }
Exemple #24
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();
    }
Exemple #25
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("更新全站缓存完成!");
    }
Exemple #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        xClass.NewsTypeData("ads", adWhere);

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

        if (!IsPostBack)
        {
            Int64 aidTemp = xc.SafeNum(Request["aid"]);
            if (aidTemp > 0)
            {
                string idNums = xClass.getClassAllID("ads", Convert.ToInt32(aidTemp));

                if (!idNums.Equals(aidTemp.ToString()))
                {
                    string[] ids = idNums.Split(new char[] { ',' });
                    for (int i = 0; i <= ids.GetUpperBound(0); i++)
                    {
                        ifStr += "classID=" + ids[i].ToString().Trim() + " or ";
                    }
                    ifStr = " and (" + ifStr.Substring(0, ifStr.Length - 3) + ")";
                }
                else
                {
                    ifStr += " and classID=" + aidTemp.ToString().Trim();
                }
                this.adWhere.Items.FindByValue(aidTemp.ToString()).Selected = true;
            }

            strSql = "select * from ads where 1=1 " + ifStr + " order by stopDate DESC,aID desc";
            //Response.Write(strSql);
            lblCurrentPage.Text = db.RepeaterDB(RepeaterList, strSql, "&aid=" + aidTemp, 5, "page", "center", true);
        }
    }
Exemple #27
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();
    }
Exemple #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XabaraCom xc = new XabaraCom();

        xc.CheckAdminLogin("|adminPW|");

        string idTemp = xc.SafeNum(Request["id"].Trim()).ToString();
        string dimStr = "@UserPW";

        string[] strValue     = new string[1];
        string   strVlaueTemp = xc.GetRnd("abc", 1) + xc.GetRnd("abc123", 7).ToLower();

        strValue[0] = xc.GetMd5(strVlaueTemp).ToString();

        if (new dbDataFunction().InsertUpdateDB("AdminUser", dimStr, strValue, "Uid=" + idTemp + " and UserId<>'" + xc.adminID + "'").Equals("更新成功"))
        {
            xc.insertMyLog(xc.adminID, "admin", "管理员密码初始化");
            xc.divError("", "新密码:" + strVlaueTemp, 350, 150, "userList.aspx", "goto");
        }
        else
        {
            xc.divError("", "不能给自己密码初始化或操作错误!", 350, 150, "userList.aspx", "goto");
        }
    }
Exemple #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        if (!Page.IsPostBack)
        {
            //自动升级
            long updateID = xc.SafeNum(Request.QueryString["update"]);
            if (updateID > 0)
            {
                xc.autoUpdate();
            }

            string   soft     = ed.softName();
            string[] softName = soft.Split(new char[] { '_' });
            soft = softName[0];

            //检查版本
            string oldVer = "v1.12.0330";
            xc.xmlSave("webVer", oldVer); //自动更新版本号
            string newVer = xc.getRomoteHtmCode("http://www.zdianpu.com/api/ver/?id=" + ed.softName(), "utf-8", "", "");
            if (string.IsNullOrEmpty(newVer as string) || newVer.IndexOf("zdianpu.com") > 0)
            {
                ver.Text = "当前版本:" + oldVer;
            }
            else
            {
                if (oldVer.Equals(newVer))
                {
                    ver.Text = "当前版本:" + oldVer + "<br />您已经是最新版本!";
                }
                else
                {
                    ver.Text = "当前版本:" + oldVer + "<br />最新版本:<span style=\"color:#b60202; font-weight:bold;\">" + newVer + "</span> 【<a href=\"http://www.zdianpu.com/soft/" + soft + "/\" target=\"_blank\" style=\"font-weight:bold;\">手工升级</a>】【<a href=\"main.aspx?update=1\" style=\"font-weight:bold;\">在线升级</a>】";
                }
            }
            buyLink.NavigateUrl = "http://www.zdianpu.com/soft/" + soft + "/server.aspx";

            adminLog.DataSource = db.getDataTable("select top 6 * from logLogin where userType='admin' and  exeTitle='管理员登录' order by id desc");
            adminLog.DataBind();
            adminLog.Dispose();

            serverIP.Text    = Request.ServerVariables["LOCAL_ADDR"] + ":" + Request.ServerVariables["Server_Port"].ToString();
            ServerOS.Text    = Environment.OSVersion.ToString();
            ServerOSVer.Text = xc.os(Environment.OSVersion.ToString());
            ServerSoft.Text  = Request.ServerVariables["SERVER_SOFTWARE"];
            netVer.Text      = Environment.Version.ToString();
            ServerPath.Text  = Request.ServerVariables["PATH_TRANSLATED"];
            serverTime.Text  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            sqlVer.Text      = db.sqlVer();

            string infoTxt = "";
            infoTxt += "<li style=\"line-height:200%; padding:2px 0px 2px 5px;\">统计离上次登录网站信息情况</li><li style=\"line-height:200%; background-color:#e9f8fc; padding:2px 0px 2px 5px;\">共有 ";

            DataTable dt;
            dt       = db.getDataTable("select count(Tid) as nums from newsTree where taobaoKe<>''");
            infoTxt += dt.Rows[0]["nums"].ToString().Trim() + " 个店铺关联信息&nbsp;&nbsp;<a href=\"../shop/taobao.aspx\" target=\"mainFrame\" style=\"color:red;\">自动更新</a></li><li style=\"line-height:200%; padding:2px 0px 2px 5px;\">共有 ";
            dt.Dispose();

            dt       = db.getDataTable("select count(num_iid) as nums from taobaoKe where isBad>0");
            infoTxt += dt.Rows[0]["nums"].ToString().Trim() + " 条淘宝客有效信息</li><li style=\"line-height:200%; background-color:#e9f8fc; padding:2px 0px 2px 5px;\">共有 ";
            dt.Dispose();

            dt       = db.getDataTable("select count(num_iid) as nums from taobaoKe where isBad<1");
            infoTxt += dt.Rows[0]["nums"].ToString().Trim() + " 个淘宝客无效信息&nbsp;&nbsp;<a href=\"../shop/Default.aspx?isBad=1\" target=\"mainFrame\" style=\"color:red;\">查看</a>&nbsp;&nbsp;<a href=\"../shop/taobaoke.aspx\" target=\"mainFrame\" style=\"color:red;\">强制转换</a></li>";
            dt.Dispose();

            infoLJ.Text = infoTxt;
        }
    }
Exemple #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        XabaraClass xClass = new XabaraClass();

        if (!IsPostBack)
        {
            string uidTemp = xc.adminID;

            Uid.Text = uidTemp;

            xClass.NewsTypeData("department", adminClass);

            string    strSql = "select * from AdminUser where userID='" + uidTemp + "'";
            DataTable dt     = db.getDataTable(strSql);

            if (dt.Rows.Count > 0)
            {
                adminName.Text = dt.Rows[0]["UserName"].ToString().Trim();

                int    cID     = Convert.ToInt32(dt.Rows[0]["classID"].ToString().Trim());
                string cidName = xClass.getClass(cID, string.Empty, string.Empty);
                if (string.IsNullOrEmpty(cidName as string))
                {
                    if (cID > 0)
                    {
                        cidName = "原分类已被删除,请重新选择!";
                        this.adminClass.Items.Add(new ListItem("== 请选择 ==", ""));
                        this.adminClass.Items.FindByValue(string.Empty).Selected = true;
                    }
                    else
                    {
                        this.adminClass.Items.Add(new ListItem("超级管理员", "0"));
                        this.adminClass.Items.FindByValue(cID.ToString()).Selected = true;
                    }
                }
                else
                {
                    this.adminClass.Items.FindByValue(cID.ToString()).Selected = true;
                }

                classLab.Text = cidName;
                if (dt.Rows[0]["UserAdmin"].ToString().Trim().Equals("xabaraCOM") && !string.IsNullOrEmpty(xc.SafeSql(Request["uid"]) as string))
                {
                    adminClass.Visible          = true;
                    adminClassValidator.Visible = true;
                }

                oldPWHidden.Value = dt.Rows[0]["UserPW"].ToString().Trim();
                adminMail.Text    = dt.Rows[0]["userEmail"].ToString().Trim();
                adminTel.Text     = dt.Rows[0]["userTel"].ToString().Trim();
                adminMobile.Text  = dt.Rows[0]["userMobile"].ToString().Trim();
                adminQQ.Text      = dt.Rows[0]["userQQ"].ToString().Trim();
            }
            else
            {
                xc.divError("", "您的操作有误!", 350, 150, "userList.aspx", "goto");
            }
            dt.Dispose();

            FormCheck fCheck = new FormCheck();
            adminNameRegularExpressionValidator.ValidationExpression = fCheck.RegExpressionValidator("chinese", 0, 0, false);
            adminNameRegularExpressionValidator.ErrorMessage         = fCheck.RegExpressionValidator("chinese", 0, 0, true);
            adminPWRegularExpressionValidator.ValidationExpression   = fCheck.RegExpressionValidator("passWord", 0, 0, false);
            adminPWRegularExpressionValidator.ErrorMessage           = fCheck.RegExpressionValidator("passWord", 0, 0, true);
            mailRegularExpressionValidator.ValidationExpression      = fCheck.RegExpressionValidator("email", 0, 0, false);
            mailRegularExpressionValidator.ErrorMessage           = fCheck.RegExpressionValidator("email", 0, 0, true);
            telRegularExpressionValidator.ValidationExpression    = fCheck.RegExpressionValidator("phone", 0, 0, false);
            telRegularExpressionValidator.ErrorMessage            = fCheck.RegExpressionValidator("phone", 0, 0, true);
            mobileRegularExpressionValidator.ValidationExpression = fCheck.RegExpressionValidator("mobile", 0, 0, false);
            mobileRegularExpressionValidator.ErrorMessage         = fCheck.RegExpressionValidator("mobile", 0, 0, true);
            qqRegularExpressionValidator.ValidationExpression     = fCheck.RegExpressionValidator("qq", 0, 0, false);
            qqRegularExpressionValidator.ErrorMessage             = fCheck.RegExpressionValidator("qq", 0, 0, true);
        }
    }
Exemple #31
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();  //定时刷新
    }
Exemple #32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        if (!IsPostBack)
        {
            xClass.NewsTypeData("taobaoke", classID);

            string ifStr     = string.Empty;
            string pageStr   = string.Empty;
            string searchStr = Server.UrlDecode(Request["keyWord"]);
            string searchIf  = string.Empty;
            string orderBy   = " Order By id desc";
            long   sale      = xc.SafeNum(Request.QueryString["sale"]);
            if (sale > 0)
            {
                orderBy  = " Order By volume DESC";
                pageStr += "&sale=1";
            }

            if (!string.IsNullOrEmpty(searchStr as string))
            {
                if (xc.SafeNum(searchStr) > 0)
                {
                    searchIf = " and num_iid=" + searchStr;
                }
                else
                {
                    searchIf = " and title like '%" + searchStr + "%'";
                }

                searchWord.Text = searchStr;
                pageStr        += "&keyWord=" + searchStr;
            }

            //显示推荐商品
            long isGood = xc.SafeNum(Request.QueryString["isGood"]);
            if (isGood > 0 || this.goodCheck.Checked)
            {
                searchIf += " and isGood>0 ";

                pageStr += "&isGood=1";

                orderBy = " Order By volume DESC";

                this.goodCheck.Checked = true;
            }

            long ifGood = xc.SafeNum(Request.QueryString["ifGood"]);
            if (ifGood > 0) //建议推荐商品
            {
                searchIf += " and isGood<1 and commission>10 and volume>1 and classID>0 ";

                pageStr += "&ifGood=1";

                orderBy = " Order By volume DESC";
            }
            if (ifGood < 0) //建议取消推荐商品或删除商品
            {
                searchIf += " and volume<2 and isGood>0 ";

                pageStr += "&ifGood=-1";

                orderBy = " Order By commission ASC";
            }

            long isBad = xc.SafeNum(Request.QueryString["isBad"]);
            if (isBad > 0)  //无效信息列表
            {
                searchIf += " and isBad=0 ";

                pageStr += "&isBad=1";
            }

            long cidTemp = xc.SafeNum(Request.QueryString["cid"]);
            if (cidTemp > 0)
            {
                this.classID.Items.FindByValue(cidTemp.ToString()).Selected = true;
                pageStr += "&cid=" + cidTemp.ToString();
            }

            if (cidTemp > 0)
            {
                string cidStr = xClass.getClassAllID("taobaoke", cidTemp); //得到所有ID
                if (cidStr.IndexOf(",") > 0)
                {
                    string[] ids = cidStr.Split(new char[] { ',' });
                    for (int i = 0; i <= ids.GetUpperBound(0); i++)
                    {
                        ifStr += " select * from taobaoke where classID=" + ids[i].ToString().Trim() + searchIf + " union ";
                    }
                }
                else
                {
                    ifStr = " select * from taobaoke where classID=" + cidTemp.ToString().Trim() + searchIf + " union ";
                }
            }
            else
            {
                ifStr = " select * from taobaoke where 1=1 " + searchIf + " union ";
            }

            ifStr = "(" + ifStr.Substring(0, ifStr.Length - 6) + ") as news";

            string strSql = "select * from " + ifStr + orderBy;
            //Response.Write(strSql);
            //Response.End();
            lblCurrentPage.Text = db.RepeaterDB(RepeaterList, strSql, pageStr, 30, "page", "center", true);
            if (this.RepeaterList.Items.Count < 1)
            {
                errInfo.Text   = "目前暂没有任何信息!";
                errDiv.Visible = true;
            }
            else
            {
                errDiv.Visible = false;
            }
        }
    }
    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();
    }
Exemple #34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("|adsEdit|");

        if (!IsPostBack)
        {
            FormCheck fCheck = new FormCheck();
            pdateRegExpree.ValidationExpression = fCheck.RegExpressionValidator("dateTime", 0, 0, false);
            pdateRegExpree.ErrorMessage         = fCheck.RegExpressionValidator("dateTime", 0, 0, true);
            eDateRegExpree.ValidationExpression = fCheck.RegExpressionValidator("dateTime", 0, 0, false);
            eDateRegExpree.ErrorMessage         = fCheck.RegExpressionValidator("dateTime", 0, 0, true);
            httpRegExpree.ValidationExpression  = fCheck.RegExpressionValidator("urlHttp", 0, 0, false);
            httpRegExpree.ErrorMessage          = fCheck.RegExpressionValidator("urlHttp", 0, 0, true);
            wRegExpree.ValidationExpression     = fCheck.RegExpressionValidator("number", 0, 0, false);
            wRegExpree.ErrorMessage             = "宽度" + fCheck.RegExpressionValidator("number", 0, 0, true);
            hRegExpree.ValidationExpression     = fCheck.RegExpressionValidator("number", 0, 0, false);
            hRegExpree.ErrorMessage             = "高度" + fCheck.RegExpressionValidator("number", 0, 0, true);

            XabaraClass xClass = new XabaraClass();
            xClass.NewsTypeData("ads", adClass);

            string img = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadImgType");
            this.adImg.Items.Add(new ListItem(img, "Img"));
            string flash = XmlReader.GetConfig(Server.MapPath("~/xabara.config"), "UploadFlashType");
            this.adImg.Items.Add(new ListItem(flash, "Flash"));
            this.adImg.Items.Add(new ListItem("广告代码", "Code"));

            DataTable dt = db.getDataTable("select * from ads where aID=" + xc.SafeNum(Request["id"]).ToString());
            if (dt.Rows.Count > 0)
            {
                this.adClass.Items.FindByValue(dt.Rows[0]["classID"].ToString().Trim()).Selected = true;
                string fileName = dt.Rows[0]["adImg"].ToString().Trim();
                upImg.Value = fileName;
                if (!string.IsNullOrEmpty(fileName as string))
                {
                    string fileExe = fileName.Substring(fileName.Length - 3);
                    if (img.IndexOf(fileExe) > -1)
                    {
                        this.adImg.Items.FindByValue("Img").Selected = true;
                    }
                    else
                    {
                        this.adImg.Items.FindByValue("Flash").Selected = true;
                    }
                }
                else
                {
                    this.adImg.Items.FindByValue("Code").Selected = true;
                }

                adW.Text       = dt.Rows[0]["adW"].ToString().Trim();
                adH.Text       = dt.Rows[0]["adH"].ToString().Trim();
                adHttp.Text    = dt.Rows[0]["adHttp"].ToString().Trim();
                adCode.Text    = dt.Rows[0]["adCode"].ToString().Trim();
                pDate.Text     = Convert.ToDateTime(dt.Rows[0]["starDate"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss");
                eDate.Text     = Convert.ToDateTime(dt.Rows[0]["stopDate"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss");
                adCodeImg.Text = dt.Rows[0]["adCode"].ToString().Trim();
            }
            else
            {
                xc.divError("", "您的操作有误!", 350, 150, "default.aspx", "goto");
            }
            dt.Dispose();
        }
    }
Exemple #35
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();
        }
        //宝贝同步结束
    }
Exemple #36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin(string.Empty);

        if (!IsPostBack)
        {
            DataTable dt;
            dt = db.getDataTable("select * from posterChannelIDs order by id ASC");
            this.classID.DataSource     = dt.DefaultView;
            this.classID.DataTextField  = "channel_name";
            this.classID.DataValueField = "id";
            this.classID.DataBind();
            dt.Dispose();
            this.classID.Items.Add(new ListItem("== 分类 ==", ""));

            string ifStr     = string.Empty;
            string pageStr   = string.Empty;
            string searchStr = Server.UrlDecode(Request["keyWord"]);
            string searchIf  = string.Empty;
            string orderBy   = " Order By posterChannelTitle.tID desc";

            if (!string.IsNullOrEmpty(searchStr as string))
            {
                searchIf        = " and (posterChannelTitle.title like '%" + searchStr + "%' or posterChannelTitle.title_short like '%" + searchStr + "%' )";
                searchWord.Text = searchStr;
                pageStr        += "&keyWord=" + searchStr;
            }

            long isGood = xc.SafeNum(Request.QueryString["isGood"]);
            if (isGood > 0 || this.goodCheck.Checked)
            {
                searchIf += " and posterChannelTitle.weight>10000 ";

                pageStr += "&isGood=1";

                orderBy = " Order By posterChannelTitle.weight DESC";

                this.goodCheck.Checked = true;
            }

            long ifGood = xc.SafeNum(Request.QueryString["ifGood"]);
            if (ifGood > 0) //建议推荐商品
            {
                searchIf += " and weight<100 and hits>10000 and create_date>'" + DateTime.Now.AddDays(-7).ToString() + "' ";
                pageStr  += "&ifGood=1";
            }

            long cidTemp = xc.SafeNum(Request.QueryString["cid"]);
            if (cidTemp > 0)
            {
                ifStr += " and posterChannelTitle.channel_id=" + cidTemp.ToString();
                this.classID.Items.FindByValue(cidTemp.ToString()).Selected = true;
                pageStr += "&cid=" + cidTemp.ToString();
            }
            else
            {
                this.classID.Items.FindByText("== 分类 ==").Selected = true;
            }

            string strSql = "select * from posterChannelTitle left join posterChannelIDs on posterChannelTitle.channel_id=posterChannelIDs.id where  posterChannelTitle.flagID=1 " + ifStr + searchIf + orderBy;
            //Response.Write(strSql);
            //Response.End();
            lblCurrentPage.Text = db.RepeaterDB(RepeaterList, strSql, pageStr, 30, "page", "center", true);
            if (this.RepeaterList.Items.Count < 1)
            {
                errInfo.Text   = "目前暂没有任何信息!";
                errDiv.Visible = true;
            }
            else
            {
                errDiv.Visible = false;
            }
        }
    }
Exemple #37
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());
                }
            }
        }
    }
Exemple #38
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();
    }
Exemple #39
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();
        }
        //宝贝同步结束
    }