用户是否“喜欢”?已经有 Facebook 帖子了

发布于 2024-10-21 08:49:07 字数 281 浏览 1 评论 0原文

我已经尝试解决这个问题有一段时间了,并且慢慢意识到我拨打的电话并不是我想要的电话。

我目前正在获取用户新闻源并添加一个“喜欢”按钮,但如果他们已经喜欢它,则应该说“不喜欢”。

我打电话给/me/likes?...并获得了一些数据(我通过比较新闻源中的每个帖子ID来进行搜索),但我刚刚意识到这些数据与用户喜欢的页面有关。它不会返回用户喜欢的帖子。

我的问题是如何确定用户是否已经喜欢某个帖子?(我担心我必须为新闻源中的每个帖子调用 api 来确定用户是否喜欢该帖子,但这会大大减慢速度移动应用程序)。

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.

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.

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).

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

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

发布评论

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

评论(1

和我恋爱吧 2024-10-28 08:49:07

只需使用 FQL like 表:

SELECT post_id 
FROM like 
WHERE post_id 
IN ("AAAAAA_AAAAAAAAAAA","BBBBBB_BBBBBBBBB","CCCCCCC_CCCCCCCCC") 
AND user_id = XXXXXXXXX

结果类似于:

[
  {
    "post_id": "CCCCCCC_CCCCCCCCC"
  }
]

fql.query 控制台

Simply using FQL like table:

SELECT post_id 
FROM like 
WHERE post_id 
IN ("AAAAAA_AAAAAAAAAAA","BBBBBB_BBBBBBBBB","CCCCCCC_CCCCCCCCC") 
AND user_id = XXXXXXXXX

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文