365体育备用网址报道24.3.2开拓实现_365体育备用网址官网资讯

依据上述接口,能够实现当微信公众账号接收到用户的地理地位消息时,同时返回公交及自驾线路给用户。相关代码如下所示:

 1 private function receiveLocation($object)
 2 {
 3     $Pondbay = array("name" => "方倍工作室", "latitude" => "22.539394", "longitude" => "113.956246");
 4     
 5     $content[] = array("Title" =>"高德地图为您导航", 
 6                         "Description" =>"", 
 7                         "PicUrl" =>"", 
 8                         "Url" =>"");
 9     $content[] = array("Title" =>"点击tb通博娱乐888察看公交线路导航", 
10                         "Description" =>"", 
11                         "PicUrl" =>"http://h.hiphotos.bdimg.com/wisegame/pic/item/1fd98d1001e9390186c2c97479ec54e737d196bc.jpg", 
12                         "Url" =>"http://mo.amap.com/?from=".$object->Location_X.",".$object->Location_Y."(".$object->Label.")&to=".$Pondbay['latitude'].",".$Pondbay['longitude']."(".$Pondbay['name'].")&type=1&opt=0&dev=1");
13     $content[] = array("Title" =>"点击tb通博娱乐888察看驾车线路导航", 
14                         "Description" =>"", 
15                         "PicUrl" =>"http://b.hiphotos.bdimg.com/wisegame/pic/item/eeb1cb1349540923f48a42079058d109b2de49e3.jpg", 
16                         "Url" =>"http://mo.amap.com/?from=".$object->Location_X.",".$object->Location_Y."(".$object->Label.")&to=".$Pondbay['latitude'].",".$Pondbay['longitude']."(".$Pondbay['name'].")&type=0&opt=1&dev=1");
17     $result = $this->transmitNews($object, $content);
18     return $result;
19 }

上述代码运行时,将返回一个多图文消息,分别显示标题、公交导航、驾车导航的消息。公交和驾车的图文消息的链接为高德地图的接口URL,接口中起始地址为用户发送的地理地位,目的地止为已定义的坐标地址。程序运行后,界面如图24-7所示:

图24-7接收地理地位信息
点击公交线路和驾车线路导航后,高德地图生成的线路规划如图24-8所示:

图24-8公交线路和驾车线路规划

------分隔线----------------------------

公布评论 (172人察看0条评论)
请自觉遵守互联网相关的政策法规,严禁公布色情、暴力、反动的言论。
用户名: 验证码: 点击我更换tb通博娱乐888
最新评论