用户是否“喜欢”一个Facebook的帖子已经 [英] Does a user "like" a Facebook post already
问题描述
我一直在试图解决这个问题,并且慢慢地意识到通话来电不是我想要的呼叫。
I have been trying to solve this one for a while now and have slowly realised that the call im making is not the desired call for what i want.
我目前正在收到用户的新闻源,并添加了一个类似的按钮,但如果他们喜欢它,它说不像。
I am currently getting the users newsfeed and adding a like button but if they like it already it shold say unlike.
我打电话/我/喜欢...并获得几点数据(我通过比较新闻源中的每个帖子ID拖网),但我刚刚意识到此数据与用户喜欢的页面相关。它不返回用户喜欢的帖子。
i call /me/likes?... and get a couple of bits of data (which i trawl through comparing each post id in newsfeed) but I have just realised this data is to do with pages that the user has liked. It doesn't return the posts the user has liked.
我的问题是我如何确定用户是否已经喜欢过一个帖子?(我的恐惧是,我必须打电话给api的每个帖子在新闻来确定用户是否喜欢这篇文章,但会大大减慢移动应用程序的速度)。
My question is how do i determine if the user has liked a post already?(my fear is that i have to make a call to the api for each post in the newsfeed to determine if the user likes this post but that would drastically slow down a mobile app).
推荐答案
只需使用FQL 像
表:
Simply using FQL like
table:
SELECT post_id
FROM like
WHERE post_id
IN ("AAAAAA_AAAAAAAAAAA","BBBBBB_BBBBBBBBB","CCCCCCC_CCCCCCCCC")
AND user_id = XXXXXXXXX
结果将是: / p>
And the result will be something like:
[
{
"post_id": "CCCCCCC_CCCCCCCCC"
}
]
It's always a good idea to test your queries in the fql.query
console.
这篇关于用户是否“喜欢”一个Facebook的帖子已经的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!