| 123456789101112131415161718192021222324252627282930313233343536 | 
							- <?php
 
- namespace App\Server;
 
- use App\Server\Location\LocationProvider;
 
- class Location
 
- {
 
-     private $appKey;
 
-     private $locate;
 
-     public function __construct($appKey)
 
-     {
 
-         $this->appKey = $appKey;
 
-     }
 
-     /**
 
-      * @param AddressProvider $data
 
-      * @param string $location
 
-      * @return string|array
 
-      */
 
-     public function getCity(AddressProvider $data, string $location)
 
-     {
 
-         $data->setKey($this->appKey);
 
-         $type = $data->getType();
 
-         $res = $data->locateToAddress(['location' => $location, 'get_poi' => 1]);
 
-         if ($res['status'] != 0) {
 
-             return $res;
 
-         }
 
-         $city = '';
 
-         if ($type == 'qq') {
 
-             $city = $res['result']['address_component']['city'];
 
-         }
 
-         return $city;
 
-     }
 
- }
 
 
  |