|
@@ -12,7 +12,7 @@ use think\Exception;
|
|
|
*/
|
|
|
class Topicdongtai extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = [];
|
|
|
+ protected $noNeedLogin = ['poi','poi2'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
//发布动态
|
|
@@ -930,6 +930,66 @@ class Topicdongtai extends Api
|
|
|
$this->success('success',$list);
|
|
|
}
|
|
|
|
|
|
+ //维智地图,POI搜索API
|
|
|
+ /*public function poi(){
|
|
|
+ $access_key = 'oLv7qgwJ5E4SdxSLvKLDRzdrkgQdLYV0';
|
|
|
+
|
|
|
+ $keyword = '人民广场';
|
|
|
+ $city_code = '';
|
|
|
+ $city = '临沂';
|
|
|
+ $page = input('page',1);
|
|
|
+
|
|
|
+ $url = 'https://api.newayz.com/location/scenario/v1/placesearch?name='.$keyword.'&access_key='.$access_key.'&city='.$city.'&page_index='.$page.'&page_size=10';
|
|
|
+
|
|
|
+ $header = ['Content-Type: application/json'];
|
|
|
+ $rs = curl_get($url,$header);
|
|
|
+ dump($rs);
|
|
|
+
|
|
|
+ }*/
|
|
|
+ //维智地图,POI搜索API
|
|
|
+ public function poi2(){
|
|
|
+ $access_key = 'oLv7qgwJ5E4SdxSLvKLDRzdrkgQdLYV0';
|
|
|
+
|
|
|
+ $longitude = input('longitude','');
|
|
|
+ $latitude = input('latitude','');
|
|
|
+ $location = $longitude.','.$latitude;
|
|
|
+
|
|
|
+ $keyword = input('keyword','');
|
|
|
+ $radius = 1000;//周边半径
|
|
|
+ $page = input('page',1);
|
|
|
+ $page_size = input('listrow',10);
|
|
|
+
|
|
|
+
|
|
|
+ $url = 'https://api.newayz.com/location/scenario/v1/nearbysearch?access_key='.$access_key.'&location='.$location.'&keywords='.$keyword.'&radius='.$radius.'&page_index='.$page.'&page_size='.$page_size;
|
|
|
+
|
|
|
+ $header = ['Content-Type: application/json'];
|
|
|
+ $rs = curl_get($url,$header);
|
|
|
+ $rs = json_decode($rs,true);
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ if(!empty($rs)){
|
|
|
+ foreach($rs as $key => $val){
|
|
|
+
|
|
|
+ if(!isset($val['geoPoint']) || empty($val['geoPoint'])){ continue; }
|
|
|
+ if(!isset($val['name']) || empty($val['name'])){ continue; }
|
|
|
+ if(!isset($val['address']['name']) || empty($val['address']['name'])){ continue; }
|
|
|
+
|
|
|
+ $location = explode(',',$val['geoPoint']);
|
|
|
+ if( !isset($location[0]) || !isset($location[1]) ){ continue; }
|
|
|
+
|
|
|
+ $result[] = [
|
|
|
+ 'longitude' => $location[0],
|
|
|
+ 'latitude' => $location[1],
|
|
|
+ 'name' => $val['name'],
|
|
|
+ 'address' => $val['address']['name'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// $this->success(1,$rs);
|
|
|
+ $this->success(1,$result);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|