Ionic 3 - 有没有办法通过开放时间按照open_now或评级来过滤谷歌餐馆?
getTypes(latLng) {
let loading = this.loadingCtrl.create({
content: 'Procurando...'
});
loading.present();
var service = new google.maps.places.PlacesService(this.map);
let request = {
location: latLng,
radius: this.isKM,
type: [this.item]
};
return new Promise((resolve, reject) => {
service.nearbySearch(request, function (results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
resolve(results);
loading.dismiss();
} else {
loading.dismiss();
reject(status);
}
});
});
}
答案 0 :(得分:0)
nearbySearch()
确实有openNow
选项,仅搜索在发送查询时打开的地点。因此,您修改的示例代码将是:
var service = new google.maps.places.PlacesService(this.map);
let request = {
location: latLng,
radius: this.isKM,
type: [this.item],
openNow: true
};
return new Promise((resolve, reject) => {
service.nearbySearch(request, function (results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
resolve(results);
loading.dismiss();
} else {
loading.dismiss();
reject(status);
}
});
});
}