Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            string Latitude  = context.Request.QueryString["Latitude"].ToString();  //纬度
            string Longitude = context.Request.QueryString["Longitude"].ToString(); //经度
            //请求、处理返回的JSON数据 并且输出
            string BaidujsonGet = publicClass.requestGet("http://api.map.baidu.com/geosearch/v3/nearby?ak=wZPaui15nEeP3nDlFTaBckSl&geotable_id=111944&location=" + Longitude + "," + Latitude + "&radius=2000000&sortby=distance:1");
            baidu  db           = new baidu();

            db = JsonHelper.DeserializeJsonToObject <baidu>(BaidujsonGet);


            List <content> userAddresss = JsonHelper.DeserializeJsonToList <content>(db.contents.ToString());

            string shopName    = userAddresss[0].title;
            string shopAddress = userAddresss[0].address;


            context.Response.ContentType = "text/plain";
            //把门店地址和详情地址拼接到下面 用,隔开
            context.Response.Write(shopName + "," + shopAddress);


            //context.Response.Write("123");
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            string Latitude = context.Request.QueryString["Latitude"].ToString();//纬度
            string Longitude = context.Request.QueryString["Longitude"].ToString();//经度
            //请求、处理返回的JSON数据 并且输出
            string BaidujsonGet = publicClass.requestGet("http://api.map.baidu.com/geosearch/v3/nearby?ak=wZPaui15nEeP3nDlFTaBckSl&geotable_id=111944&location=" + Longitude + "," + Latitude + "&radius=2000000&sortby=distance:1");
            baidu db = new baidu();
            db = JsonHelper.DeserializeJsonToObject<baidu>(BaidujsonGet);

            List<content> userAddresss = JsonHelper.DeserializeJsonToList<content>(db.contents.ToString());

            string shopName = userAddresss[0].title;
            string shopAddress = userAddresss[0].address;

            context.Response.ContentType = "text/plain";
            //把门店地址和详情地址拼接到下面 用,隔开
            context.Response.Write(shopName + "," + shopAddress);

            //context.Response.Write("123");
        }