有没有办法通过营业时间过滤谷歌地方餐厅?
Posted
技术标签:
【中文标题】有没有办法通过营业时间过滤谷歌地方餐厅?【英文标题】:Is there a way to filter Google places restaurants by opening hours? 【发布时间】:2018-09-04 00:30:06 【问题描述】:Ionic 3 - 有没有办法通过营业时间过滤 Google 地点餐厅,以按 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);
);
);
【问题讨论】:
【参考方案1】:PlacesService 中的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);
);
);
Nearby Search Documentation
【讨论】:
以上是关于有没有办法通过营业时间过滤谷歌地方餐厅?的主要内容,如果未能解决你的问题,请参考以下文章