Esempio n. 1
0
        public IHttpActionResult TQGGet(TbkJuTqgGetRequest req)
        {
            ITopClient client = new DefaultTopClient(_tbkApiUrl, _appkey, _secret, _format);

            req.AdzoneId = _adzoneId;
            req.Fields   = "click_url,pic_url,reserve_price,zk_final_price,total_amount,sold_num,title,category_name,start_time,end_time";
            TbkJuTqgGetResponse rsp = client.Execute(req);

            return(Json(rsp.Body));
        }
Esempio n. 2
0
/// <summary>
        /// taobao.tbk.ju.tqg.get( 淘抢购api )
        /// doc:https://open.taobao.com/api.htm?docId=27543&docType=2
        /// </summary>
        public static void QueryJuTqg()
        {
            var client             = GetClient();
            TbkJuTqgGetRequest req = new TbkJuTqgGetRequest();

            //推广位id(推广位申请方式:http://club.alimama.com/read.php?spm=0.0.0.0.npQdST&tid=6306396&ds=1&page=1&toread=1)
            req.AdzoneId  = 123L;
            req.Fields    = "click_url,pic_url,reserve_price,zk_final_price,total_amount,sold_num,title,category_name,start_time,end_time";
            req.StartTime = DateTime.Parse("2016-08-09 09:00:00"); //最早开团时间
            req.EndTime   = DateTime.Parse("2016-08-09 16:00:00"); //最晚开团时间
            req.PageNo    = 1L;
            req.PageSize  = 40L;
            TbkJuTqgGetResponse rsp = client.Execute(req);

            Console.WriteLine(rsp.Body);
        }
Esempio n. 3
0
        public List <TqgItem> getTqgItem(int page, DateTime startTime, DateTime endTime)
        {
            TbkJuTqgGetRequest req = new TbkJuTqgGetRequest();

            req.AdzoneId  = adzone_id;
            req.Fields    = "num_iid,click_url,pic_url,reserve_price,zk_final_price,total_amount,sold_num,title,category_name,start_time,end_time";
            req.PageNo    = page;
            req.StartTime = startTime;
            req.EndTime   = endTime;
            TbkJuTqgGetResponse response = topClient.Execute(req);
            JToken         token         = JsonConvert.DeserializeObject <JObject>(response.Body)["tbk_ju_tqg_get_response"];
            List <TqgItem> result        = new List <TqgItem>();

            if (token["results"] == null)
            {
                return(null);
            }
            JToken tokenList = token["results"]["results"];

            foreach (JToken item in tokenList)
            {
                string click_url = item["click_url"] == null ? "" : item["click_url"].ToString();
                if (Convert.ToDouble(item["zk_final_price"].ToString()) > 5 && click_url.Length > 50)
                {
                    result.Add(new TqgItem()
                    {
                        title          = item["title"] == null ? "" : item["title"].ToString(),
                        total_amount   = Convert.ToInt32(item["total_amount"].ToString()),
                        click_url      = click_url,
                        category_name  = item["category_name"] == null ? "" : item["category_name"].ToString(),
                        zk_final_price = item["zk_final_price"] == null ? "" : item["zk_final_price"].ToString(),
                        end_time       = Convert.ToDateTime(item["end_time"].ToString()),
                        sold_num       = Convert.ToInt32(item["sold_num"].ToString()),
                        start_time     = Convert.ToDateTime(item["start_time"].ToString()),
                        pic_url        = item["pic_url"] == null ? "" : item["pic_url"].ToString(),
                        num_iid        = Convert.ToInt64(item["total_amount"].ToString()),
                        reserve_price  = item["reserve_price"] == null ? "" : item["reserve_price"].ToString(),
                    });
                }
            }
            return(result);
        }