简体   繁体   English

Facebook FQL查询让所有用户在线

[英]Facebook FQL query to get all users online

I keep record of all users of my app in local, MySQL database. 我在本地MySQL数据库中记录了我的应用程序的所有用户。 I have all the relevant information required to get user online presence status [ UID, access_token and granted extended permission ]. 我拥有获取用户在线状态[ UID, access_token和授予extended permission ]所需的所有相关信息。

How do I get online presence status of all users? 如何获得所有用户的在线状态?

The approach I am using at the moment, is to query each user separately: 我目前使用的方法是分别查询每个用户:

$facebook->api(array
(
    'access_token'  => 'x',
    'method'        => 'fql.query',
    'query'     => "SELECT uid, name, first_name, last_name, online_presence FROM user WHERE uid = x"
));

But this is time taking procedure with 150 users. 但这是150个用户的时间。 I am not even talking about 400+ or 1000+. 我甚至不是在谈论400多岁或1000多岁。

ps multiquery didn't work for me, because asking user presence requires to provide the access_token . ps multiquery对我不起作用,因为要求用户存在需要提供access_token

我的解决方案

SELECT name, uid, online_presence FROM user WHERE uid=me()

For all online 对于所有在线

SELECT name,uid FROM user WHERE
  online_presence IN ('active', 'idle')

With friend 和朋友

SELECT name,uid FROM user WHERE
  online_presence IN ('active', 'idle')
  AND uid IN (
    SELECT uid2 FROM friend WHERE uid1 = $user_id
  )

This isn't really an option and in terms of why you would need this data, it is not readily apparent as to the purpose of it. 这不是一个真正的选择,就你为何需要这些数据而言,它的目的并不明显。 Maybe if you could provide more information, a different solution would be available. 也许如果您能提供更多信息,可以使用不同的解决方案。

Another viable option is to rely on the Chat API. 另一个可行的选择是依赖Chat API。 This will tell you all the users that are set to online status in Facebook Chat. 这将告诉您在Facebook Chat中设置为在线状态的所有用户。 This wouldn't be too reliable as this includes users accessing solely the Facebook Chat(desktop/mobile software) as opposed to the actual website users. 这不太可靠,因为这包括用户仅访问Facebook聊天(桌面/移动软件)而不是实际的网站用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM