...
|
...
|
@@ -338,7 +338,27 @@ class Member extends WechatBase |
|
|
}
|
|
|
$this->success('success');
|
|
|
}
|
|
|
public function getCity(){
|
|
|
$url = "https://restapi.amap.com/v3/geocode/regeo?parameters";
|
|
|
public function get_city(){
|
|
|
$longitude = $this->request->param('longitude');
|
|
|
$latitude = $this->request->param('latitude');
|
|
|
if(empty($longitude) || empty($latitude)){
|
|
|
$this->error('404');
|
|
|
}
|
|
|
$url = "https://apis.map.qq.com/ws/geocoder/v1/?location= $latitude,$longitude";
|
|
|
$result = self::http_get($url);
|
|
|
$data = json_decode($result,true);
|
|
|
dump($data);
|
|
|
}
|
|
|
public static function http_get($url){
|
|
|
$ch = curl_init();
|
|
|
curl_setopt($ch, CURLOPT_URL,$url);
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
|
|
$result = curl_exec($ch);
|
|
|
// grab URL, and print
|
|
|
if(curl_errno($ch)){
|
|
|
print curl_error($ch);
|
|
|
}
|
|
|
curl_close($ch);
|
|
|
return $result;
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|