Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List <Product_Class> GetCategories(BUser user)
        {
            List <Product_Class>     categories = new List <Product_Class>();
            SellercatsListGetRequest req        = new SellercatsListGetRequest();

            req.Nick = user.Mall_Name;
            SellercatsListGetResponse response = client.Execute(req);

            if (response.IsError)
            {
                throw new KMJXCException(response.ErrMsg);
            }

            if (response.SellerCats != null)
            {
                foreach (TB.SellerCat cat in response.SellerCats)
                {
                    Product_Class category = new Product_Class();
                    category.Create_Time      = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                    category.Create_User_ID   = user.ID;
                    category.Enabled          = true;
                    category.Mall_CID         = cat.Cid.ToString();
                    category.Mall_PCID        = cat.ParentCid.ToString();
                    category.Name             = cat.Name;
                    category.Parent_ID        = 0;
                    category.Product_Class_ID = 0;
                    categories.Add(category);
                }
            }
            return(categories);
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<Product_Class> GetCategories(BUser user)
        {
            List<Product_Class> categories = new List<Product_Class>();
            SellercatsListGetRequest req = new SellercatsListGetRequest();
            req.Nick = user.Mall_Name;
            SellercatsListGetResponse response = client.Execute(req);
            if (response.IsError)
            {
                throw new KMJXCException(response.ErrMsg);
            }

            if (response.SellerCats != null)
            {
                foreach (TB.SellerCat cat in response.SellerCats)
                {
                    Product_Class category = new Product_Class();
                    category.Create_Time = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                    category.Create_User_ID = user.ID;
                    category.Enabled = true;
                    category.Mall_CID = cat.Cid.ToString();
                    category.Mall_PCID = cat.ParentCid.ToString();
                    category.Name = cat.Name;
                    category.Parent_ID = 0;
                    category.Product_Class_ID = 0;
                    categories.Add(category);
                }
            }
            return categories;
        }
Example #3
0
        ////����API��taobao.sellercats.list.get; ��ȡ����Լ��IJ�Ʒ��Ŀ
        /// <summary>
        ///     ����API��taobao.sellercats.list.get; ��ȡ����Լ��IJ�Ʒ��Ŀ
        /// </summary>
        /// <param name="userNick">�Ա��dz�</param>
        public List<SellerCat> GetSellercatsList(string userNick)
        {
            if (string.IsNullOrEmpty(userNick))
                throw new Exception(Resource.ExceptionTemplate_MethedParameterIsNullorEmpty
                                            .StringFormat(new StackTrace().ToString()));

            var reqCats = new SellercatsListGetRequest {Nick = userNick};
            SellercatsListGetResponse responseCats = client.Execute(reqCats);

            return responseCats.SellerCats;
        }
Example #4
0
        /// <summary>
        /// 获取前台展示的店铺内卖家自定义商品类目
        /// </summary>
        /// <param name="NickName"></param>
        internal List <SellerCat> GetSPLM(string NickName)
        {
            ITopClient client            = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
            SellercatsListGetRequest req = new SellercatsListGetRequest();

            req.Nick = NickName;
            SellercatsListGetResponse  response = client.Execute(req);
            TopJsonParser              topjson  = new TopJsonParser();
            SellercatsListGetResponse1 resp     = topjson.Parse <SellercatsListGetResponse1>(response.Body);

            return(resp.SellerCats);
        }
Example #5
0
        ////店铺API,taobao.sellercats.list.get; 获取卖家自己的产品类目
        /// <summary>
        ///     店铺API,taobao.sellercats.list.get; 获取卖家自己的产品类目
        /// </summary>
        /// <param name="userNick">淘宝昵称</param>
        public List <SellerCat> GetSellercatsList(string userNick)
        {
            if (string.IsNullOrEmpty(userNick))
            {
                throw new Exception(Resource.ExceptionTemplate_MethedParameterIsNullorEmpty
                                    .StringFormat(new StackTrace().ToString()));
            }

            var reqCats = new SellercatsListGetRequest {
                Nick = userNick
            };
            SellercatsListGetResponse responseCats = client.Execute(reqCats);

            return(responseCats.SellerCats);
        }
Example #6
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");
        //记录店铺基本信息
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop = client.ShopGet(request);
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "remain_count " +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + shop.RemainCount + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);
        //记录店铺分类信息
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Fields = "cid,parent_cid,name,is_parent";
        request1.Nick   = nick;
        PageList <SellerCat> cat = client.SellercatsListGet(request1);

        for (int i = 0; i < cat.Content.Count; i++)
        {
            sql = "INSERT INTO TopTaobaoShopCat (" +
                  "cid, " +
                  "parent_cid, " +
                  "name, " +
                  "pic_url, " +
                  "sort_order, " +
                  "created, " +
                  "nick, " +
                  "modified " +
                  " ) VALUES ( " +
                  " '" + cat.Content[i].Cid + "', " +
                  " '" + cat.Content[i].ParentCid + "', " +
                  " '" + cat.Content[i].Name + "', " +
                  " '" + cat.Content[i].PicUrl + "', " +
                  " '" + cat.Content[i].SortOrder + "', " +
                  " '" + cat.Content[i].Created + "', " +
                  " '" + nick + "', " +
                  " '" + cat.Content[i].Modified + "' " +
                  ") ";
            utils.ExecuteNonQuery(sql);
        }

        //记录店铺所有商品信息-暂不记录
    }
Example #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_session");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid  = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           act    = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
    }
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_sessiongroupbuy");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        string appkey = "12159997";
        string secret = "614e40bfdb96e9063031d1a9e56fbed5";

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid   = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           isradio = utils.NewRequest("isradio", utils.RequestType.QueryString);
        string           act     = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                if (isradio == "1")
                {
                    Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>");
                }
                else
                {
                    Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>");
                }
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
        else if (act == "getResultStr")
        {
            string      items    = utils.NewRequest("ids", utils.RequestType.QueryString);
            string[]    arr      = items.Split(',');
            List <Item> itemList = new List <Item>();

            //标志
            int flag = 1;
            if (arr.Length == 1)
            {
                flag = 0;
            }

            for (int i = flag; i < arr.Length; i++)
            {
                ItemGetRequest request = new ItemGetRequest();
                request.Fields = "num_iid,title,price,pic_url";
                request.NumIid = long.Parse(arr[i]);

                Item product = client.ItemGet(request);
                itemList.Add(product);
            }

            string str = string.Empty;
            //根据不同样式显示不同的字符串
            string style = utils.NewRequest("style", utils.RequestType.QueryString);

            //string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'";
            //DataTable dtNew = utils.ExecuteDataTable(sqlNew);
            //string nickid = string.Empty;
            //if (dtNew.Rows.Count != 0)
            //{
            //    nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/";
            //}
            //else
            //{
            //    nickid = "http://www.taobao.com/";
            //}


            if (isradio == "1")
            {
                //团购需要的商品数据
                for (int i = 0; i < itemList.Count; i++)
                {
                    str = "<div id=item_" + itemList[i].NumIid.ToString() + " style=\"float:left;width:46px;border:solid 1px #ccc;padding:2px;margin:2px;\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_40x40.jpg\" border=0 title=\"" + itemList[i].Title + "\" /></A><br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\"><br><a href=\"javascript:delitem(" + itemList[i].NumIid.ToString() + ")\">删除</a></div>";
                }
            }

            Response.Write(str);
        }
    }
Example #9
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        //记录店铺基本信息
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "versionNo, " +
                     "remain_count " +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + versionNo + "', " +
                     " '" + shop.RemainCount + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);



        //记录店铺分类信息
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Fields = "cid,parent_cid,name,is_parent";
        request1.Nick   = nick;
        PageList <SellerCat> cat = client.SellercatsListGet(request1);

        for (int i = 0; i < cat.Content.Count; i++)
        {
            sql = "INSERT INTO TopTaobaoShopCat (" +
                  "cid, " +
                  "parent_cid, " +
                  "name, " +
                  "pic_url, " +
                  "sort_order, " +
                  "created, " +
                  "nick, " +
                  "modified " +
                  " ) VALUES ( " +
                  " '" + cat.Content[i].Cid + "', " +
                  " '" + cat.Content[i].ParentCid + "', " +
                  " '" + cat.Content[i].Name + "', " +
                  " '" + cat.Content[i].PicUrl + "', " +
                  " '" + cat.Content[i].SortOrder + "', " +
                  " '" + cat.Content[i].Created + "', " +
                  " '" + nick + "', " +
                  " '" + cat.Content[i].Modified + "' " +
                  ") ";
            utils.ExecuteNonQuery(sql);
        }

        //记录店铺所有商品信息-暂不记录
    }
Example #10
0
        private void PublishProduct()
        {
            string authCode = null;
            if (!GetAuthorizeCode( out authCode))
            {
                MessageBox.Show("没有找到相应的 authCode");
                return;
            }

            context = TopUtils.GetTopContext(authCode);

            ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "21479233", "98dd6f00daf3f94322ec1a4ff72370b7");

            #region 获取店铺类目

            SellercatsListGetRequest reqCats = new SellercatsListGetRequest();
            reqCats.Nick = context.UserNick;
            SellercatsListGetResponse responseCats = client.Execute(reqCats);
            sellerCats = responseCats.SellerCats;

            // var cats = responseCats.SellerCats.FirstOrDefault(f => f.Name == "");

            //714827841
            #endregion

            ItemAddRequest req = new ItemAddRequest();
            req.Num = 30L;
            req.Price = "2000.07";
            req.Type = "fixed";
            req.StuffStatus = "new";
            req.Title = "美邦男装";
            req.Desc = "这是一个好商品";
            req.LocationState = "浙江";
            req.LocationCity = "杭州";
            //req.ApproveStatus = "onsale";
            req.Cid = 50000436;
               // req.Props = "20000:33564;21514:38489";
            req.FreightPayer = "buyer";
            //req.ValidThru = 7L;
            req.HasInvoice = false;
            req.HasWarranty = false;
            req.HasShowcase = false;
            req.SellerCids = GetCatsList("T恤 - 长袖T恤;T恤 - 短袖T恤;T恤 - 圆领T恤", "Metersbonwe - 女装");
            req.HasDiscount = true;
            req.PostFee = "15.07";
            req.ExpressFee = "15.07";
            req.EmsFee = "25.07";
            DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            req.ListTime = dateTime;
            req.Increment = "2.50";
            FileItem fItem = new FileItem(@"C:\Users\Administrator\Desktop\a.png");
            req.Image = fItem;
               // req.PostageId = 775752L;
            //req.AuctionPoint = 5L;
            req.PropertyAlias = "pid:vid:别名;pid1:vid1:别名1";
            req.InputPids = "20000";
            req.SkuProperties = "pid:vid;pid:vid";
            req.SkuQuantities = "2,3,4";
            req.SkuPrices = "200.07";
            req.SkuOuterIds = "1234,1342";
            req.Lang = "zh_CN";
            req.OuterId = "12345";
            req.ProductId = 123456789L;
            req.PicPath = "i7/T1rfxpXcVhXXXH9QcZ_033150.jpg";
            req.AutoFill = "time_card";
            req.InputStr = "耐克;";
            req.IsTaobao = true;
            req.IsEx = true;
            req.Is3D = true;
            req.SellPromise = true;
            req.AfterSaleId = 47758L;
            req.CodPostageId = 53899L;
            req.IsLightningConsignment = true;
            req.Weight = 100L;
            req.IsXinpin = false;
            req.SubStock = 1L;
            req.FoodSecurityPrdLicenseNo = "QS410006010388";
            req.FoodSecurityDesignCode = "Q/DHL.001-2008";
            req.FoodSecurityFactory = "远东恒天然乳品有限公司";
            req.FoodSecurityFactorySite = "台北市仁爱路4段85号";
            req.FoodSecurityContact = "00800-021216";
            req.FoodSecurityMix = "有机乳糖、有机植物油";
            req.FoodSecurityPlanStorage = "常温";
            req.FoodSecurityPeriod = "2年";
            req.FoodSecurityFoodAdditive = "磷脂 、膨松剂";
            req.FoodSecuritySupplier = "深圳岸通商贸有限公司";
            req.FoodSecurityProductDateStart = "2012-06-01";
            req.FoodSecurityProductDateEnd = "2012-06-10";
            req.FoodSecurityStockDateStart = "2012-06-20";
            req.FoodSecurityStockDateEnd = "2012-06-30";
            req.GlobalStockType = "1";
            req.ScenicTicketPayWay = 1L;
            req.ScenicTicketBookCost = "5.99";
            req.ItemSize = "bulk:8";
            req.ItemWeight = "10";
            req.ChangeProp = "162707:28335:28335,28338";
            req.LocalityLifeChooseLogis = "0";
            req.LocalityLifeExpirydate = "2012-08-06,2012-08-16";
            req.LocalityLifeNetworkId = "5645746";
            req.LocalityLifeMerchant = "56879:码商X";
            req.LocalityLifeVerification = "101";
            req.LocalityLifeRefundRatio = 50L;
            req.LocalityLifeOnsaleAutoRefundRatio = 80L;
            req.PaimaiInfoMode = 1L;
            req.PaimaiInfoDeposit = 20L;
            req.PaimaiInfoInterval = 5L;
            req.PaimaiInfoReserve = "11";
            req.PaimaiInfoValidHour = 2L;
            req.PaimaiInfoValidMinute = 22L;
            ItemAddResponse response = client.Execute(req, context.SessionKey);
        }
Example #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_sessionblog");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid   = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           isradio = utils.NewRequest("isradio", utils.RequestType.QueryString);
        string           act     = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                if (isradio == "1")
                {
                    Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
                }
                else
                {
                    Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
                }
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
        else if (act == "getResultStr")
        {
            string      items    = utils.NewRequest("ids", utils.RequestType.QueryString);
            string[]    arr      = items.Split(',');
            List <Item> itemList = new List <Item>();

            //标志
            int flag = 1;
            if (arr.Length == 1)
            {
                flag = 0;
            }

            for (int i = flag; i < arr.Length; i++)
            {
                ItemGetRequest request = new ItemGetRequest();
                request.Fields = "num_iid,title,price,pic_url";
                request.NumIid = long.Parse(arr[i]);

                Item product = client.ItemGet(request);
                itemList.Add(product);
            }

            string str = string.Empty;
            //根据不同样式显示不同的字符串
            string style = utils.NewRequest("style", utils.RequestType.QueryString);

            string    sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'";
            DataTable dtNew  = utils.ExecuteDataTable(sqlNew);
            string    nickid = string.Empty;
            if (dtNew.Rows.Count != 0)
            {
                nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/";
            }
            else
            {
                nickid = "http://www.taobao.com/";
            }


            if (isradio == "1")
            {
                //团购需要的商品数据
                for (int i = 0; i < itemList.Count; i++)
                {
                    str = "<A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A><br>" + itemList[i].Title + "<br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\">";
                }
            }
            else
            {
                if (style == "1")
                {
                    str += "<table background=\"http://www.7fshop.com/top/show1/4.gif\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\" style=\"border-right: #999999 1px solid; border-top: #999999 1px solid;border-left: #999999 1px solid; border-bottom: #999999 1px solid\" width=\"580\"><tr><td>    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"><table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\"><tr><td width=\"10\"></td><td background=\"http://www.7fshop.com/top/show1/1.gif\" width=\"24\"></td><td background=\"http://www.7fshop.com/top/show1/2.gif\"><font color=\"white\" style=\"font-size: 13px\"><strong>掌柜推荐商品</strong></font></td><td><img src=\"http://www.7fshop.com/top/show1/3.gif\" /></td></tr></table></td><td align=\"right\"></td></tr></table></td></tr></table>  <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-right: #999999 1px solid;border-top: #999999 1px solid; overflow: hidden; border-left: #999999 1px solid;border-bottom: #999999 1px solid\" width=\"578\"><tr><td valign=\"top\"><TABLE cellSpacing=0 cellPadding=0 width=578 border=0><TBODY><TR><TD align=\"middle\"><TABLE cellSpacing=8 cellPadding=0 align=center border=0><TBODY><TR>";
                    for (int i = 0; i < itemList.Count; i++)
                    {
                        str += "<TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD align=\"middle\"><DIV style=\"BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; MARGIN-TOP: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 160px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 160px\"><DIV style=\"OVERFLOW: hidden; WIDTH: 160px; HEIGHT: 160px\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A></DIV></DIV></TD></TR><TR><TD align=\"middle\"><DIV style=\"PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px\"><A style=\"FONT-SIZE: 12px; COLOR: #3f3f3f; TEXT-DECORATION: none\" href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</A><BR /><FONT style=\"COLOR: #fe596a\"><B>¥&nbsp;" + itemList[i].Price + "元</B></FONT> </DIV><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"http://www.7fshop.com/top/show1/buy1.gif\" border=0 /></A> <DIV></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>";
                        if ((i + 1) % 3 == 0)
                        {
                            str += "</tr><tr>";
                        }
                    }

                    str += "</TR></TBODY></TABLE></td></tr><tr><td align=\"right\" height=\"24\" style=\"border-bottom: #999999 1px solid\" valign=\"center\"><a href=\"" + nickid + "\" style=\"text-decoration: none\" target=\"_blank\"><font style=\"font-size: 13px; color: #ff6600\"><strong>更多详情请见 " + nickid + "</strong>&nbsp;</font></a></td></tr></table></td></tr></table>";
                }
                else
                {
                    for (int i = 0; i < itemList.Count; i++)
                    {
                        str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + itemList[i].PicUrl + "\" border=\"0\" /></a><br />";
                        str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</a> 售价:" + itemList[i].Price + "元<br><br>";
                    }
                }
            }
            Response.Write(str);
        }
    }
Example #12
0
    /// <summary>
    /// 增加活动图片到店铺分类
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        string appkey = "12159997";
        string secret = "614e40bfdb96e9063031d1a9e56fbed5";
        string name   = utils.NewRequest("left", utils.RequestType.Form);
        string istop  = utils.NewRequest("leftimgistop", utils.RequestType.Form);
        int    order  = 0;


        //保存到数据库
        string sql = "UPDATE TopAutoReview SET leftimgname = '" + name + "', leftimgistop = '" + istop + "' WHERE nick = '" + nick + "'";

        utils.ExecuteNonQuery(sql);

        //通过接口同步到淘宝
        TopXmlRestClient clientaa = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        //左侧分类的图片位置默认在最下面,获取当前序列号最大的
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Nick   = nick;
        request1.Fields = "name,sort_order,parent_cid";
        PageList <SellerCat> cat = clientaa.SellercatsListGet(request1, session);

        if (cat.Content.Count == 0)
        {
            order = 1;
        }
        else
        {
            int max = 0;
            for (int i = 0; i < cat.Content.Count; i++)
            {
                if (cat.Content[i].ParentCid == 0 && cat.Content[i].SortOrder > max)
                {
                    max = cat.Content[i].SortOrder;
                }
            }
            order = max + 1;
        }

        //判断该店铺是否增加过该分类
        string isok  = "0";
        string catid = string.Empty;

        for (int i = 0; i < cat.Content.Count; i++)
        {
            if (cat.Content[i].Name == "好评有礼_特特营销")
            {
                isok  = "1";
                catid = cat.Content[i].Cid.ToString();
                break;
            }
        }

        if (isok == "0")
        {
            //添加到左侧分类
            SellercatsListAddRequest request = new SellercatsListAddRequest();
            request.Name      = "好评有礼_特特营销";
            request.PictUrl   = GetTaobaoImg(name, "left");
            request.SortOrder = order;
            clientaa.SellercatsListAdd(request, session);
        }
        else
        {
            //更新分类图片
            SellercatsListUpdateRequest request = new SellercatsListUpdateRequest();
            request.Cid     = int.Parse(catid);
            request.PictUrl = GetTaobaoImg(name, "left");
            clientaa.SellercatsListUpdate(request, session);
        }


        Response.Write("<script>alert('同步成功!');window.location.href='html.aspx';</script>");
        Response.End();
        return;
    }
Example #13
0
    /// <summary>
    /// 增加活动图片到店铺分类
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        string appkey = "12132145";
        string secret = "1fdd2aadd5e2ac2909db2967cbb71e7f";
        string name   = utils.NewRequest("left", utils.RequestType.Form);
        string istop  = utils.NewRequest("leftimgistop", utils.RequestType.Form);
        int    order  = 0;

        //保存到数据库
        string sql = "UPDATE TCS_ShopConfig SET leftimgname = '" + name + "', leftimgistop = '" + istop + "' WHERE nick = '" + nick + "'";

        utils.ExecuteNonQuery(sql);

        //通过接口同步到淘宝
        TopXmlRestClient clientaa = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        //左侧分类的图片位置默认在最下面,获取当前序列号最大的
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Nick   = nick;
        request1.Fields = "name,sort_order,parent_cid";
        PageList <SellerCat> cat = clientaa.SellercatsListGet(request1, session);

        if (cat.Content.Count == 0)
        {
            order = 1;
        }
        else
        {
            int max = 0;
            for (int i = 0; i < cat.Content.Count; i++)
            {
                if (cat.Content[i].ParentCid == 0 && cat.Content[i].SortOrder > max)
                {
                    max = cat.Content[i].SortOrder;
                }
            }
            order = max + 1;
        }

        //判断该店铺是否增加过该分类
        string isok  = "0";
        string catid = string.Empty;

        for (int i = 0; i < cat.Content.Count; i++)
        {
            //Response.Write(cat.Content[i].Name + "<br>");

            if (cat.Content[i].Name == "好评有礼_特特营销")
            {
                isok  = "1";
                catid = cat.Content[i].Cid.ToString();
                break;
            }
        }
        //Response.End();

        if (isok == "0")
        {
            IDictionary <string, string> param = new Dictionary <string, string>();
            param.Add("name", "好评有礼_特特营销");
            param.Add("pict_url", GetTaobaoImg(name, "left"));
            param.Add("sort_order", order.ToString());

            string result = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.sellercats.list.add", session, param);

            //Response.Write(result);
            //Response.End();

            ////添加到左侧分类
            //SellercatsListAddRequest request = new SellercatsListAddRequest();
            //request.Name = "好评有礼_特特营销";
            //request.PictUrl = GetTaobaoImg(name, "left");
            //request.SortOrder = order;
            //clientaa.SellercatsListAdd(request, session);
        }
        else
        {
            IDictionary <string, string> param = new Dictionary <string, string>();
            param.Add("cid", catid);
            param.Add("pict_url", GetTaobaoImg(name, "left"));

            string result = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.sellercats.list.update", session, param);

            ////更新分类图片
            //SellercatsListUpdateRequest request = new SellercatsListUpdateRequest();
            //request.Cid = int.Parse(catid);
            //request.PictUrl = GetTaobaoImg(name, "left");
            //clientaa.SellercatsListUpdate(request, session);
        }


        Response.Write("<script>alert('同步成功,如果是第一次同步左侧分类可能需要多等待一会才能看到,或者您可以在店铺装修里面发布一下即可!');window.location.href='html.aspx';</script>");
        Response.End();
        return;
    }
Example #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_sessiongroupbuy");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid   = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           isradio = utils.NewRequest("isradio", utils.RequestType.QueryString);
        string           act     = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                string    tempstr = "未参加促销活动";
                string    sql     = "select * from Tete_activitylist where Status<>4 and Status<>3 and Status<>2 and  ProductID=" + product.Content[i].NumIid.ToString().Trim();
                DataTable dt      = utils.ExecuteDataTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    tempstr = " <font color=green> 已参加促销活动</font><br/><a href=\"javascript:delItemAction(" + product.Content[i].NumIid.ToString().Trim() + "," + dt.Rows[0]["ActivityID"].ToString() + ")\">删除此促销活动</a><div id='del" + product.Content[i].NumIid.ToString().Trim() + "'></div>";
                }

                string str = " <table  width=\"800px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:0px; padding:0px\">  <tr><td style=\" width:100px;\"><img width=50px src=" + product.Content[i].PicUrl + "_80x80.jpg></td><td  style=\" width:300px;\"><a   href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\">" + product.Content[i].Title + "</a></td><td  style=\" width:150px;\">" + product.Content[i].Price.ToString() + "</td><td  style=\" width:250px;\">" + tempstr + "</td></tr> </table><hr/>";
                Response.Write(str);
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
            Response.End();
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
            Response.End();
        }
        else if (act == "getResultStr")
        {
            string      items    = utils.NewRequest("ids", utils.RequestType.QueryString);
            string[]    arr      = items.Split(',');
            List <Item> itemList = new List <Item>();

            //标志
            int flag = 1;
            if (arr.Length == 1)
            {
                flag = 0;
            }

            for (int i = flag; i < arr.Length; i++)
            {
                ItemGetRequest request = new ItemGetRequest();
                request.Fields = "num_iid,title,price,pic_url";
                request.NumIid = long.Parse(arr[i]);

                Item product = client.ItemGet(request);
                itemList.Add(product);
            }

            string str = string.Empty;
            //根据不同样式显示不同的字符串
            string style = utils.NewRequest("style", utils.RequestType.QueryString);

            string    sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'";
            DataTable dtNew  = utils.ExecuteDataTable(sqlNew);
            string    nickid = string.Empty;
            if (dtNew.Rows.Count != 0)
            {
                nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/";
            }
            else
            {
                nickid = "http://www.taobao.com/";
            }

            for (int i = 0; i < itemList.Count; i++)
            {
                str += "<div id='div" + itemList[i].NumIid.ToString() + "' width=\"800px\"><table width=\"800px\"><tr width=\"800px\"><td width=\"90px\"><a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + itemList[i].PicUrl + "_80x80.jpg\" border=\"0\" /></a></td>";
                str += "<td  width=\"140px\"><a   href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</a> </td><td   width=\"200px\"><input type=\"text\" size=\"27\" id=\"groupbuylistname" + itemList[i].NumIid.ToString() + "\"   name=\"groupbuylistname\"  maxlength=\"30\"  value=\"\" /></td><td  width=\"100px\"> " + itemList[i].Price + "元 <input   type=\"hidden\" id=\"productid" + itemList[i].NumIid.ToString() + "\" name=\"productid\"  value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price" + itemList[i].NumIid.ToString() + "\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\"></td><td  width=\"100px\">  <input type=\"text\" id=\"zhekou" + itemList[i].NumIid.ToString() + "\" size=\"10\" name=\"zhekou\" onblur=\"setzekou(this)\" /> 元 <br /> 打<input type=\"text\" size=\"8\" id=\"zhekou1" + itemList[i].NumIid.ToString() + "\" name=\"zhekou1\"   onblur=\"setprice(this)\"/> 折 <br />限购:<select id=\"xiangou" + itemList[i].NumIid.ToString() + "\" name=\"xiangou\"> <OPTION selected  value=0>否</OPTION> <OPTION  value=1>是</OPTION> </select>  <span id=\"errmsg" + i + "\" style=\"color:Red\"></span> </td><td  width=\"90px\">  <input type=\"text\"  size=\"8\"  name=\"rcount\" value=\"300\" /> </td><td  width=\"80px\"><a onclick=\"deleteDIV('del1" + itemList[i].NumIid.ToString() + "')\"  style=\"cursor:hand;\">删除</a></td></tr></table><input id=\"del1" + itemList[i].NumIid.ToString() + "\" name=\"del\" value='' type=\"hidden\" ></div>";
            }

            Response.Write(str);
            Response.End();
        }
        else if (act == "getactivityitem")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product           = client.ItemsOnsaleGet(request, session);
            string          str               = string.Empty;
            string          discountType      = string.Empty; //促销方式(打折:DISCOUNT,减价:PRICE)
            string          discountValue     = string.Empty; //促销力度(7折限制)
            string          Rcount            = "300";        //已参团人数(只在对设置团购模板时有用)
            string          newPrice2         = string.Empty; //促销价
            string          price2            = string.Empty; //商品价格
            string          itemtype2         = string.Empty;
            string          itemtypevalue2    = string.Empty;
            string          yhCount           = string.Empty;
            string          hdstr             = string.Empty;
            string          aid               = Request.QueryString["aid"].ToString();
            string          yuanitemtype      = "";
            string          yuandiscountType  = "";
            string          yuandiscountValue = "";
            string          yuandecreaseNum   = "";

            string    sql2 = "select * from tete_activity where id=" + aid;
            DataTable dt33 = utils.ExecuteDataTable(sql2);
            if (dt33 != null)
            {
                yuanitemtype      = dt33.Rows[0]["itemType"].ToString();
                yuandiscountType  = dt33.Rows[0]["discountType"].ToString();
                yuandiscountValue = dt33.Rows[0]["discountValue"].ToString();
                yuandecreaseNum   = dt33.Rows[0]["decreaseNum"].ToString();
            }

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                //先判断该商品是否已经参团(状态为:进行中和暂停中)
                string    sql    = "SELECT *  FROM  tete_activitylist where ProductID=" + product.Content[i].NumIid.ToString() + " and (Status=3 or Status=1 or Status=0)  and nick='" + taobaoNick + "'";
                DataTable dtNew2 = utils.ExecuteDataTable(sql);
                // 取得促销价格
                if (dtNew2 != null && dtNew2.Rows.Count > 0)
                {
                    Rcount        = dtNew2.Rows[0]["Rcount"].ToString();
                    discountValue = dtNew2.Rows[0]["discountValue"].ToString();
                    discountType  = dtNew2.Rows[0]["discountType"].ToString();
                    price2        = product.Content[i].Price;
                    hdstr         = "<div id=\"del" + product.Content[i].NumIid.ToString() + "\">已参加活动:" + dtNew2.Rows[0]["name"].ToString() + " <br><a href=\"javascript:delItemAction(" + product.Content[i].NumIid.ToString() + ")\">删除此促销活动</a></div> <div style=\"display:none\" id=\"add" + product.Content[i].NumIid.ToString() + "\"><a href=\"javascript:addItemAction(" + product.Content[i].NumIid.ToString() + ")\">参加活动</a></div> ";

                    if (discountType.Trim() == "DISCOUNT")
                    {
                        itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>";

                        itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"" + discountValue + "\"  name=\"discountValue\" style=\"width:30px\">折</div><div  style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" >元</div>";
                        if (discountValue != "")
                        {
                            newPrice2 = (decimal.Parse(price2) * decimal.Parse(discountValue) * 0.1m).ToString();
                        }
                        else
                        {
                            newPrice2 = price2;
                        }

                        yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span  style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>";
                    }
                    else
                    {
                        itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option   value=\"DISCOUNT\">打折</option><option  selected=\"selected\"  value=\"PRICE\">减价</option> </select>";

                        if (dtNew2.Rows[0]["decreaseNum"].ToString() == "0")
                        {
                            yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>";
                        }
                        else
                        {
                            yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option value=\"0\">多件</option> <option value=\"1\"  selected=\"selected\">一件</option> </select></span>";
                        }
                        itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\" ><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"9\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display: block;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"" + discountValue + "\" >元</div>";

                        if (discountValue != "")
                        {
                            newPrice2 = (decimal.Parse(price2) - decimal.Parse(discountValue)).ToString();
                        }
                        else
                        {
                            newPrice2 = price2;
                        }
                    }
                }
                else
                {
                    hdstr = " <div id=\"add" + product.Content[i].NumIid.ToString() + "\"><a href=\"javascript:addItemAction(" + product.Content[i].NumIid.ToString() + ")\">参加活动</a></div>";
                    if (yuanitemtype == "same")
                    {
                        //same:每个参加活动的宝贝设置相同促销力度,different:每个参加活动的宝贝设置不同促销力度)
                        //decreaseNum		是否优惠限制(0,1)

                        if (yuandiscountType == "PRICE")
                        {
                            itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option  value=\"DISCOUNT\">打折</option><option selected=\"selected\" value=\"PRICE\">减价</option> </select>";

                            itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"\" name=\"discountValue\" style=\"width:30px\">折</div><div  style=\"display:block ;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"" + yuandiscountValue + "\" >元</div>";
                            if (yuandecreaseNum == "0")
                            {
                                yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span  style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>";
                            }
                            else
                            {
                                yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span  style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option  value=\"0\">多件</option> <option value=\"1\" selected=\"selected\">一件</option> </select></span>";
                            }

                            if (discountValue != "")
                            {
                                newPrice2 = (decimal.Parse(product.Content[i].Price) - decimal.Parse(yuandiscountValue)).ToString();
                            }
                            else
                            {
                                newPrice2 = product.Content[i].Price;
                            }
                        }
                        else
                        {
                            itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>";

                            yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span  style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>";

                            itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"" + yuandiscountValue + "\" name=\"discountValue\" style=\"width:30px\">折</div><div  style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"\" >元</div>";
                            if (discountValue != "")
                            {
                                newPrice2 = (decimal.Parse(product.Content[i].Price) * decimal.Parse(yuandiscountValue) * 0.1m).ToString();
                            }
                            else
                            {
                                newPrice2 = product.Content[i].Price;
                            }
                        }
                    }
                    else
                    {
                        itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>";


                        yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span  style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>";

                        itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"9\" name=\"discountValue\" style=\"width:30px\">折</div><div  style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"\" >元</div>";


                        newPrice2 = product.Content[i].Price;
                    }
                }

                str += "<div id='div" + product.Content[i].NumIid.ToString() + "' width=\"800px\"><table width=\"800px\"><tr width=\"800px\"><td  width=\"15px\"><!--<input type=\"checkbox\" id=\"" + product.Content[i].NumIid.ToString() + "\" class=\"selector\" value=\"" + product.Content[i].NumIid.ToString() + "\" name=\"iids\">--></td><td width=\"100px\"> <a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + product.Content[i].PicUrl + "_80x80.jpg\" width=\"50px\" height=\"50px\" border=\"0\" /></a></td>"; //图片
                str += "<td  width=\"140px\"><a   href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\">" + product.Content[i].Title + "</a> </td>";                                                                                                                                                                                                                                                                                                                                                                                               //名称
                str += "<td  width=\"70px\"> " + product.Content[i].Price + " <input type=\"hidden\" id=\"price" + product.Content[i].NumIid.ToString() + "\" name=\"price\" value=\"" + product.Content[i].Price.ToString() + "\"></td>";                                                                                                                                                                                                                                                                                                                                                              //商品原价
                str += "<td  width=\"70px\" id=\"newPrice" + product.Content[i].NumIid.ToString() + "\"> " + newPrice2 + "</td>";                                                                                                                                                                                                                                                                                                                                                                                                                                                                       //促销价
                str += "<td  width=\"70px\"><div id=\"yhlxDiv" + product.Content[i].NumIid.ToString() + "\"> " + itemtype2 + "</div></td>";                                                                                                                                                                                                                                                                                                                                                                                                                                                             //优惠类型
                str += "<td  width=\"70px\"> <div id=\"yhhdDiv" + product.Content[i].NumIid.ToString() + "\"> " + itemtypevalue2 + "</div></td>";                                                                                                                                                                                                                                                                                                                                                                                                                                                       //优惠幅度
                str += "<td  width=\"70px\"> <div id=\"yhslDiv" + product.Content[i].NumIid.ToString() + "\">" + yhCount + "</div></td>";                                                                                                                                                                                                                                                                                                                                                                                                                                                               //优惠数量
                str += "<td  width=\"70px\"> <input type=\"text\"   id=\"Rcount" + product.Content[i].NumIid.ToString() + "\" name=\"Rcount\" style=\"width:30px\" value=\"" + Rcount + "\" ></td>";                                                                                                                                                                                                                                                                                                                                                                                                    //参团人数
                str += "<td  width=\"140px\">" + hdstr + " </td>";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      //操作
                str += "</tr></table></div>";
            }
            Response.Write(str);
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML

            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
            Response.End();
        }
    }
    private void Act(string uid, string taobaonick)
    {
        string sql = "SELECT * FROM TeteShop WHERE nick = '" + uid + "'";

        DataTable dt = utils.ExecuteDataTable(sql);

        if (dt.Rows.Count != 0)
        {
            //同步分类数据
            TopXmlRestClient         client   = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", dt.Rows[0]["appkey"].ToString(), dt.Rows[0]["appsecret"].ToString());
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent,";
            request1.Nick   = taobaonick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除之前的老分类
            //sql = "DELETE FROM TeteShopCategory WHERE nick = '" + uid + "'";
            //utils.ExecuteNonQuery(sql);

            for (int i = 0; i < cat.Content.Count; i++)
            {
                //过滤其他软件增加的分类
                if (cat.Content[i].Name.IndexOf("统计") != -1 || cat.Content[i].Name.IndexOf("多买多优惠") != -1)
                {
                    continue;
                }

                //如果已经存在则不处理
                sql = "SELECT COUNT(*) FROM TeteShopCategory WHERE cateid='" + cat.Content[i].Cid + "'";
                string count2 = utils.ExecuteString(sql);
                if (count2 == "0")
                {
                    sql = "INSERT INTO TeteShopCategory (" +
                          "cateid, " +
                          "catename, " +
                          "oldname, " +
                          "parentid, " +
                          "nick " +
                          " ) VALUES ( " +
                          " '" + cat.Content[i].Cid + "', " +
                          " '" + cat.Content[i].Name + "', " +
                          " '" + cat.Content[i].Name + "', " +
                          " '" + cat.Content[i].ParentCid + "', " +
                          " '" + uid + "' " +
                          ") ";
                    //Response.Write(sql + "<br>");
                    utils.ExecuteNonQuery(sql);
                }

                if (cat.Content[i].ParentCid == 0)
                {
                    sql = "SELECT COUNT(*) FROM TeteShopAds WHERE nick = '" + uid + "' AND typ = '" + cat.Content[i].Cid + "'";
                    string count1 = utils.ExecuteString(sql);
                    if (count1 == "0")
                    {
                        sql = "INSERT INTO TeteShopAds (" +
                              "typ, " +
                              "url, " +
                              "orderid, " +
                              "nick " +
                              " ) VALUES ( " +
                              " '" + cat.Content[i].Cid + "', " +
                              " 'http://langbow.tmall.com', " +
                              " '1', " +
                              " '" + uid + "' " +
                              ") ";
                        utils.ExecuteNonQuery(sql);

                        sql = "INSERT INTO TeteShopAds (" +
                              "typ, " +
                              "url, " +
                              "orderid, " +
                              "nick " +
                              " ) VALUES ( " +
                              " '" + cat.Content[i].Cid + "', " +
                              " 'http://langbow.tmall.com', " +
                              " '2', " +
                              " '" + uid + "' " +
                              ") ";
                        utils.ExecuteNonQuery(sql);

                        sql = "INSERT INTO TeteShopAds (" +
                              "typ, " +
                              "url, " +
                              "orderid, " +
                              "nick " +
                              " ) VALUES ( " +
                              " '" + cat.Content[i].Cid + "', " +
                              " 'http://langbow.tmall.com', " +
                              " '3', " +
                              " '" + uid + "' " +
                              ") ";
                        utils.ExecuteNonQuery(sql);
                    }
                }
            }


            //清除之前的老商品数据
            //sql = "DELETE FROM TeteShopItem WHERE nick = '" + uid + "'";
            //utils.ExecuteNonQuery(sql);

            //同步商品数据
            for (int j = 1; j <= 500; j++)
            {
                ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                request.Fields   = "num_iid,title,price,pic_url,seller_cids";
                request.PageSize = 200;
                request.PageNo   = j;

                PageList <Item> product = client.ItemsOnsaleGet(request, dt.Rows[0]["session"].ToString());
                for (int i = 0; i < product.Content.Count; i++)
                {
                    //Response.Write(i.ToString() + "--" + product.Content[i].Title + "<br>");
                    sql = "SELECT COUNT(*) FROM TeteShopItem WHERE nick = '" + uid + "' AND itemid = '" + product.Content[i].NumIid + "'";
                    string count3 = utils.ExecuteString(sql);
                    //Response.Write(count3 + "<br>");
                    if (count3 == "0")
                    {
                        sql = "INSERT INTO TeteShopItem (" +
                              "cateid, " +
                              "itemid, " +
                              "itemname, " +
                              "picurl, " +
                              "linkurl, " +
                              "price, " +
                              "nick " +
                              " ) VALUES ( " +
                              " '" + product.Content[i].SellerCids + "', " +
                              " '" + product.Content[i].NumIid + "', " +
                              " '" + product.Content[i].Title + "', " +
                              " '" + product.Content[i].PicUrl + "', " +
                              " 'http://a.m.taobao.com/i" + product.Content[i].NumIid + ".htm', " +
                              " '" + product.Content[i].Price + "', " +
                              " '" + uid + "' " +
                              ") ";
                        utils.ExecuteNonQuery(sql);
                        Response.Write(sql + "<br>");

                        //更新分类数量
                        sql = "UPDATE TeteShopCategory SET catecount = catecount + 1 WHERE nick = '" + uid + "' AND CHARINDEX(cateid, '" + product.Content[i].SellerCids + "') > 0";
                        Response.Write(sql + "<br>");
                        utils.ExecuteNonQuery(sql);
                    }
                    else
                    {
                        sql = "UPDATE TeteShopItem SET cateid = '" + product.Content[i].SellerCids + "' WHERE itemid = '" + product.Content[i].NumIid + "'";
                        Response.Write(sql + "<br>");
                        utils.ExecuteNonQuery(sql);
                    }
                }
                //Response.Write(product.Content.Count + "<br>");


                if (product.Content.Count < 200)
                {
                    break;
                }
            }


            //更新大类商品数量
            sql = "SELECT * FROM TeteShopCategory WHERE nick = '" + uid + "' AND parentid <> 0";
            DataTable dtCate = utils.ExecuteDataTable(sql);
            for (int k = 0; k < dtCate.Rows.Count; k++)
            {
                //Response.Write(sql + "<br>");
                sql = "UPDATE TeteShopCategory SET catecount = catecount + " + dtCate.Rows[k]["catecount"].ToString() + " WHERE nick = '" + uid + "' AND cateid = " + dtCate.Rows[k]["parentid"].ToString();
                utils.ExecuteNonQuery(sql);
            }
        }
    }