日期:2014-05-17  浏览次数:20399 次

请教关于淘宝API获取商品信息后分页的问题~在线等
小弟最近在做秒杀网站 通过淘宝API获取数据 现在已经获取成功 只是无法分页

private void BindHot()
    {
        string url = "http://gw.api.taobao.com/router/rest";
        string appkey = Config.app_key;
        string appsecret = Config.app_secret;
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        TaobaokeItemsGetRequest req = new TaobaokeItemsGetRequest();
        req.Fields = "num_iid,click_url";
        req.Nick = Config.nick;
        req.Pid = Config.pid;
        req.Keyword = "打折秒杀";
        req.StartPrice = "1";
        req.PageSize = 15;
        AspNetPager1.PageSize = Convert.ToInt32(req.PageSize);
        req.EndPrice = "100";
        req.Sort = "price_asc";
        DataTable dt = new DataTable();
        string[] LieMing = { "Title", "NumIid", "PicUrl", "Price", "ClickUrl", "Num", "FreightPayer" };
        for (int i = 0; i < LieMing.Length; i++)
            {
                dt.Columns.Add(LieMing[i].ToString(), typeof(string));
            }
        for (int o = 0; o <10; o++)
        {
            TaobaokeItemsGetResponse response = client.Execute(req);
            List<TaobaokeItem> tbis = response.TaobaokeItems;
            
            for (int i = 0; i < response.TaobaokeItems.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr["ClickUrl"] = tbis[i].ClickUrl.ToString();
                Item tbdi = DetailProduct(tbis[i].NumIid.ToString());
                dr["Num"] = tbdi.Num.ToString();
                dr["FreightPayer"] = tbdi.FreightPayer.ToString() == "seller