2012-02-12 3 views

답변

1
var fbid = your_fbuid_here;   
     FB.api({ 
        method: 'fql.query', 
        query: 'SELECT thread_id, author_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND author_id = ' + fbid + ' ORDER BY created_time ASC LIMIT 1' 
       }, function (threadresponse) { 
        FB.api({ 
         method: 'fql.query', 
         query: 'SELECT thread_id, body, author_id, created_time FROM message WHERE thread_id = ' + threadresponse[0].thread_id + ' ORDER BY created_time ASC' 
        }, function (inboxresponse) { 
          //do stuff here with results 
        }); 
       }); 

또는이

var fbid =the _freind_fb_uid_here;   
      FB.api({ 
         method: 'fql.query', 
         query: 'SELECT thread_id, body, author_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0) AND author_id = ' + fbid + ' ORDER BY created_time DESC' 
        }, function (threadresponse) { 
           //do stuff here with results 
        }); 

+0

흠, 이건 내 첫 번째 스레드를 반환합니다, 그건 내가 찾고있는 것이 아닙니다. –

+0

your_fbuid는 메시지와 일치시키려는 사람 중 하나입니다. 첫 번째 쿼리는 스레드 fql에서 thread_id를 가져 오는 것이고 두 번째 fql은 모든 메시지를 가져 오는 것입니다. –

+0

잘 메시징 스레드의 작성자가 될 수도 있으므로 작동하지 않습니다. –

0

이제 FQL가없는 필드 author_idoriginatorsnippet_author을 할 수 있습니다. 그러나이 필드에는 잘못된 데이터가 들어 있습니다. 예를 들어, userA는 나에게 userB 메시지를 보냅니다 : userA는 스레드를 만듭니다. 어쨌든 나는 그 창안자가 나 (userB)를 가지고 볼 수 있습니다.

가장 좋은 방법은 사용 recipients :

SELECT recipients,snippet,object_id,updated_time,unread,unseen,thread_id FROM thread WHERE folder_id=0 AND recipients IN (userA_fid, userB_fid) 

그러나 그것은 또한 일을하고 빈 데이터를 반환하지 않는 것 ...