【发布时间】:2020-05-16 13:39:29
【问题描述】:
我在 google 日历帐户中有单独的日历,当我调用日历 API 时,我目前需要在每次要拨打电话时迭代每组日历。我有 5 个日历组,我只想从中“读取”,大约需要 4 秒来分别询问每组日历。
当我调用 calendar-api 时,有没有办法同时传递所有日历?
// Look for the calendars we need to check
$queryCalendars = $dbase->prepare('SELECT `calendar` FROM `googleCalanders`');
$queryCalendars->execute();
while ($row = $queryCalendars->fetch(PDO::FETCH_OBJ)) {
$checkCalandars[] = $row->calendar; // Give me an Array of all the calandars we need
}
// Check to see if we need to collect the data from the cloud or if we can use the cached version
$foundEvents=[];
foreach ($checkCalandars as $checkThisCalendar){
// Print the next 7 events on the specific calendars.
$calendarId = $checkThisCalendar;
$optParams = array(
'maxResults' => 7,
'orderBy' => 'startTime',
'singleEvents' => TRUE,
'timeMin' => $checkTime
);
$results = $service->events->listEvents($calendarId, $optParams);
我只想将 $calendarId 传递给 API 一次,让它告诉我这些日历中的所有事件,而不是一次一个地执行每个事件。这可能吗?
【问题讨论】: