如何只上传配置文件照片的朋友,并忽略那些默认轮廓的用户? [英] How to get only friends with profile photos uploaded, and ignore those users with the default silhouette?
问题描述
我无法用个人资料照片获得朋友的方式。我可以使用多查询来检查每个朋友是否都有一张照片,但是会导致交通流量不足。
I cannot figure a way get friends only with profile photos. I could use multi-query to check whether every friend has a photo, but that would incur heavy traffic.
是否有其他选择?
推荐答案
尽管Gajus的建议查询可能现在可以正常工作,但一旦Facebook更改了CDN上默认图片的URL 。 (可能发生,可能不会发生。)
Although Gajus’ suggested query might work right now, it’ll break once Facebook changes the URL of the default picture on their CDN. (Might happen, might not happen.)
所以我建议改进:
profile_pic
表有一个名为 is_silhouette
的字段,这是一个布尔值,用于用户是否设置了自己的个人资料图片。
The profile_pic
table has a field called is_silhouette
, which is a boolean for whether the user has their own profile picture set or not.
所以,只有那些你的朋友,有一张个人资料图片,你可以使用
So to get only those of your friends, that have a profile picture set, you can use
SELECT uid, name FROM user WHERE uid IN
(SELECT id FROM profile_pic WHERE
id IN (SELECT uid1 FROM friend WHERE uid2 = me() )
AND NOT is_silhouette
)
- > 在Graph API Explorer中尝试此查询。
这篇关于如何只上传配置文件照片的朋友,并忽略那些默认轮廓的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!