0

我正在构建一个 facebook 应用程序,用户可以从我们的用户为我们的每个产品提交的照片库中“喜欢”“图片”(这些是动作和对象名称)。每当用户喜欢一张图片时,我也会发送一个(必需的)自定义参数,即产品 ID。

有没有办法检索当前用户对特定产品 ID 的喜爱行为?我正在使用 javascript fb sdk。我试图将尽可能多的 facebook 相关内容从我的后端系统中排除,所以我宁愿不在我的数据库中存储用户数据。

感谢您的任何帮助/建议,

汤姆

4

1 回答 1

0

您需要自己进行过滤,但是是的,您可以这样做。尝试类似的东西

// This will return everything the user has loved
FB.api('/me/<your app namespace>:love', function(response) {
  for(var i = 0; i < response.data.length; i++) {
    var post = response.data[i];
    // Make sure that this is a post about loving a pic
    // and that the product_id is what we're looking for
    if(post.data.hasOwnProperty('pic') &&
       post.data.hasOwnProperty('product_id') &&
       post.data.product_id == desiredProductId) {
      // This is a post for loving a pic for the desired product id
    }
  }
});
于 2013-03-08T10:35:52.320 回答