Facebook FQL - 用户正在参加的所有粉丝专页活动

发布于 2024-10-14 05:18:39 字数 1549 浏览 5 评论 0原文

我试图通过 Facebook 的 Multiquery FQL 实现以下目标,获取我“参加”的所有粉丝页面活动的列表。

我有以下逻辑,并尝试实现与下面的 FQL 语句类似的东西。

  1. 获取由/从粉丝页面创建的所有事件的列表(使用特定 id)
  2. 获取参加的所有我(用户)事件的列表
  3. 从 event_member FQL 表匹配 eid
  4. 如果它们与 id 匹配,并且 rsvp_status 等于参加
  5. 显示结果。

FQL多

{"query1":"从事件 WHERE 中选择 eid eid IN(从 event_member 中选择 eid 哪里uid =$fanpageID)","query2":"从 event_member WHERE 中选择 rsvp_status uid = $uidAND eid IN (从 #query1 选择 eid)"}

我知道这个语句是不正确的,但我正在努力尝试这样做。我通过 Graph API 在我的 PHP 代码中使用一组非常混乱的 foreach 循环实现了这一点。

使用单个多查询FQL 语句会更有效。

编辑

现在遇到的问题是 ifaour 的 FQL 语句在 FQL 查询控制台中工作(返回结果),但是当我运行以下命令时,会返回空数组

。剖析该语句以 ( SELECT eid FROM event WHERE Creator =$fanPageID) FQL 控制台会突出显示不可索引的 eid

这是我的 PHP

函数userEventsPoints($uid, $facebook、$fanpageID){

 $events = "从事件中选择 eid WHERE Creator=$fanpageID AND eid

IN(从 event_member 中选择 eid,其中 uid=$uid 和 rsvp_status = \"出席\")";

 $eventsAttendance = $facebook->api(array(
              '方法' => 'fql.query',
              '查询'=>$events, ));

        $eventsAttendingcount = 0;

foreach ($eventsAttendance 为 $eventsAttendanceFetch){

 if($eventsAttendanceFetch['eid'] == true){
                $eventsAttendingcount++;
            }
        }
        返回$eventsAttendingcount;
   }
<块引用>

块引用

有什么想法吗?

I am trying to achieve the following via Facebook's Multiquery FQL, get a list of all Fan Page Events that i am 'Attending'.

I have the below logic, and have tried to implement something similar with the FQL statement below.

  1. get list of all events created by / from a Fan Page (using specific id)
  2. get a list of all my (the users) events attending
  3. Match eid's from event_member FQL Table
  4. If they match ids, and rsvp_status is equal to attending
  5. display result.

FQL Multi

{"query1":"SELECT eid FROM event WHERE
eid IN (SELECT eid FROM event_member
WHERE uid
=$fanpageID)","query2":"SELECT rsvp_status FROM event_member WHERE
uid = $uidAND eid IN
(SELECT eid FROM #query1)"}

I know the statement is incorrect, but i am struggling on trying to do this. I have achieved this via Graph API using a very messy set of foreach loops in my PHP code.

Using a single multiquery FQL statement would be far more efficient.

Any suggestions would be great.

EDIT

Problem im having now, is ifaour's FQL statement works within the FQL Query console (Returns Results), however when i run the following, and empty array is returned.

When i dissect the statement to just ( SELECT eid FROM event WHERE creator =$fanPageID) the FQL Console highlights that eid in non indexable.

Here is my PHP

function usersEventsPoints($uid,
$facebook, $fanpageID){

        $events = "SELECT eid FROM event WHERE creator=$fanpageID AND eid

IN (SELECT eid FROM event_member WHERE
uid=$uid AND rsvp_status =
\"attending\")";

        $eventsAttendance = $facebook->api(array(
              'method' => 'fql.query',
              'query' =>$events, ));

        $eventsAttendingcount = 0;

foreach
($eventsAttendance as $eventsAttendanceFetch) {

    if($eventsAttendanceFetch['eid'] == true){
                $eventsAttendingcount++;
            }
        }
        return $eventsAttendingcount;
   }

Blockquote

Any Ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烂人 2024-10-21 05:18:39

这是一个非常简单的任务:

SELECT eid FROM event WHERE creator = $fanpageID AND eid IN (SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending")

这将返回由具有 $fanpageID id 的页面创建/拥有的所有事件的 ID,并且您是 (me() 中的成员)并且您的状态为参加

编辑
您循环返回的数组只是为了获取计数?!您可以简单地使用:

$eventsAttendingcount = count($eventsAttendance);

同时确保您匹配的用户已授权您的应用程序并授予您正确的权限!

It's a very simple task:

SELECT eid FROM event WHERE creator = $fanpageID AND eid IN (SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending")

This will return all events' Ids that are created/owned by the page that has $fanpageID id and you are a member in (me()) and your status is attending.

EDIT:
You are looping the returned array just to get the count?! you can simply use:

$eventsAttendingcount = count($eventsAttendance);

Also make sure that the user you are matching, has authorized your application and granted you the correct permission!

我不确定我是否理解问题所在 - 我运行了您的 FQL 语句,它返回了事件列表,然后返回了您的 RSVP 状态?

另一方面,为什么不使用 events.get 方法。你传入UserId,它就会为你显示事件信息。您可以按 RSVP 状态进行过滤。

刚刚检查,events.get 方法正在被弃用。

您应该使用新的 Graph API,它会为您提供活动参与者列表:

http:// /developers.facebook.com/docs/reference/api/event

获取与会者列表

您可以使用https://graph.facebook.com/EVENT_ID/attending

I'm not sure I understand what the problem is - I ran your FQL statement and it returns a list of events and then your RSVP status?

On another note, why not use the events.get method. You pass in the UserId and it will display the event information for you. You can filter by RSVP status.

Just checked and the events.get method is in the process of being deprecated.

You should use the new Graph API which gives you a list of attendees for your event:

http://developers.facebook.com/docs/reference/api/event

You get the list of attendees by using

https://graph.facebook.com/EVENT_ID/attending

多情出卖 2024-10-21 05:18:39

如果您想获取 facebook 登录用户的接下来 10 个事件,其中事件设置为 attending,那么您可以像这样构建 Swift 查询:

let graphPath = "/me/events?limit=10&type=attending&since=now"
let params = ["fields": "id, name, category, start_time, end_time, timezone, updated_time, type, attending_count, owner, place"]

let request = GraphRequest(graphPath: graphPath, parameters: params, accessToken: accessToken, httpMethod: .GET, apiVersion: apiVersion)
request.start {}

If you want to get the next 10 events of the facebook logged user where events are set a attending then you can build your Swift query like this:

let graphPath = "/me/events?limit=10&type=attending&since=now"
let params = ["fields": "id, name, category, start_time, end_time, timezone, updated_time, type, attending_count, owner, place"]

let request = GraphRequest(graphPath: graphPath, parameters: params, accessToken: accessToken, httpMethod: .GET, apiVersion: apiVersion)
request.start {}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文