需要在不使用JS的情况下获取共同朋友的名字和图片。
以下为共同朋友找到FQL查询:
"SELECT uid1 FROM friend WHERE uid2=[targetID] AND uid1 IN (SELECT uid2 FROM friend WHERE uid1=[sourceID])"
有没有一种方法,而不是只返回uid1
我可以得到该人的名字和图片?
EDIT -----------想想我找到了它。
"SELECT first_name, last_name, pic_small FROM user WHERE uid IN(SELECT uid1 FROM friend WHERE uid2=['targetID'] AND uid1 IN (SELECT uid2 FROM friend WHERE uid1=['sourceID']))
"
答案 0 :(得分:8)
您可以通过Graph API获得共同的朋友:
https://graph.facebook.com/me/mutualfriends/FRIEND_ID
您可以在共享朋友的用户对象中阅读更多相关信息: https://developers.facebook.com/docs/reference/api/user/
进一步补充:
答案 1 :(得分:3)
SELECT uid, first_name, last_name, pic_small
FROM user
WHERE uid IN (
SELECT uid2
FROM friend
WHERE uid1 = ['sourceID']
)
AND uid IN (
SELECT uid2
FROM friend
WHERE uid1 = ['targetID']
)
这将找到任何用户(A),源用户(B)和目标用户(C)都是朋友。不一定相反;与B和C成为朋友。
如果朋友表真的是镜像的(即对于每一行(x,y),也有行(y,x)),这种区别无关紧要。