【问题标题】: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);
      }
    });
  });
}

【问题讨论】:

    标签: google-maps typescript ionic-framework google-maps-api-3 ionic3


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-26
      • 1970-01-01
      • 2011-10-03
      • 1970-01-01
      相关资源
      最近更新 更多