日期:2014-05-17 浏览次数:20408 次
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