0

我需要以某种方式获得使用同一个应用程序的朋友之间的共同点赞,一些 FQL 最终返回给我最常见的点赞列表,这可能吗?

谢谢。

4

1 回答 1

0

我已经看过了,要根据可索引的 user_id 字段获得当前用户的喜欢,您需要当前用户的 user_access 令牌。

https://developers.facebook.com/docs/reference/fql/like/

这基本上意味着,只有您的应用程序在特定时间的当前用户才能根据他们的喜好查询信息。类似以下查询的内容可能对您有用。请注意,您需要 read_stream 权限

select object_id, user_id,object_type FROM like WHERE object_id in(SELECT object_id FROM like WHERE user_id =me()) and user_id in(select uid FROM user WHERE uid in(SELECT uid2 FROM friend where uid1 = me()) and is_app_user='true')

你可以试试这个

https://developers.facebook.com/tools/explorer/433871385166/?fql=select%20object_id%2C%20user_id%2Cobject_type%20FROM%20like%20WHERE%20object_id%20in(SELECT%20object_id%20FROM%20like%20WHERE%20user_id%20%3Dme())%20and%20user_id%20in(select%20uid%20FROM%20user%20WHERE%20uid%20in(SELECT%20uid2%20FROM%20friend%20where%20uid1%20%3D%20me())%20and%20is_app_user%3D'true')

然后,您很可能需要使用一些服务器端代码来分析返回的数据以计算最流行的数据。可能通过创建一个数组,遍历数据,根据 object_id 检查数组中是否有一个键,如果没有将该键添加到值为 1 的数组中(其中 1 是计数),否则增加值减 1。

伪代码示例

  $data; // This would be what was returned from your FQL query
  $compare = array();
  foreach($data as $value){
    if(array_key_exists($value['object_id'],$compare)){
       $compare['object_id'] = $value['object_id'] + 1;
    }else{
       $compare['object_id'] = 1;
    }
  }
  // Do some sorting function to compare the counts.
  //you would then probably need to batch queries to get the name/title of the object that the user has liked

我希望这能给你一个好的起点

于 2012-08-08T16:26:18.373 回答