2

我正在开发一个通过 FQL 从 facebook Pages 检索事件的应用程序。有时这些页面的所有者不会从页面配置文件中创建这些事件,而是从他们自己的配置文件中创建这些事件,并且只是将事件链接到页面作为场地场地(因为我正在寻找的页面是公共场所)

是否可以通过 FQL 或任何其他方式获取所有具有特定 facebook 页面 ID 作为场地的活动 ID?

现在,只有当页面所有者使用以下代码通过页面配置文件插入事件时,我才能获取所有事件:

$fql    =   "SELECT eid, creator, name, pic, timezone, start_time, end_time, location, description 
            FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid IN  ($clubsstring) )
            AND start_time > $today
            AND start_time < $nextweek
            ORDER BY start_time asc";

$param  =   array(
    'method'    => 'fql.query',
    'query'     => $fql,
    'callback'  => ''
);

$fqlResult   =   $facebook->api($param);

谢谢卢卡

4

2 回答 2

1

好吧,您确实可以根据场所进行搜索,但这只能是次要条件,因为场所字段不可索引。

这意味着您首先必须根据 eid(Event表中唯一的可索引字段)进行搜索,然后根据地点过滤这些结果。

问题是场地字段是一个数组,其中的字段并不总是存在,例如一个事件可能有这个作为场地:

"venue": {
    "id": VENUE_ID
}

但另一个会有:

"venue": {
    "street": "", 
    "city": "", 
    "state": "", 
    "country": ""
}

您应该能够通过以下方式获得您想要的东西:

SELECT eid, creator, name, pic, timezone, start_time, end_time, location, description 
FROM event
WHERE 
    ((eid IN (SELECT eid FROM event_member WHERE uid IN ($clubsstring)))
    OR
    (eid IN (SELECT eid FROM event_member WHERE uid IN (OWNERS_IDS_STRING)))
    AND
    venue.id IN (VENUE_IDS_STRING))
    AND start_time > $today
    AND start_time < $nextweek
    ORDER BY start_time asc;

我还没有测试过这个查询,你可能需要对其进行一些修改才能工作,你也可以使用除id.

希望这可以帮助。

于 2012-05-30T10:47:17.647 回答
1

我用这个,它目前正在工作。

{"eventos":"SELECT start_time, end_time, name, eid, pic,venue.id, location, creator, description 
FROM event WHERE eid IN  (SELECT eid FROM event_member WHERE uid IN (  SELECT uid2 FROM friend WHERE uid1=me() LIMIT 150) 
 OR uid = me() AND rsvp_status = 'attending') AND venue.id <>'' 
 AND location <> '' AND location <> '#data'","lugares":"SELECT latitude,longitude  
 FROM place WHERE page_id IN (SELECT venue.id FROM #eventos)"}
于 2012-07-13T13:49:06.833 回答