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; } }