2012年7月15日 星期日

不用腦FQL語法

自己以及朋友的uid,姓名,以及50x50的頭像連結
SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())



SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
http://jasonblog.tw/2011/12/facebook-comments-for-blogger.html


自己的uid 名字小圖
SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())


某id的相簿名稱相簿id
SELECT name,aid FROM album  WHERE aid IN (SELECT aid  FROM album WHERE owner = 要查的fbid )


fb大張大頭貼
SELECT src_big FROM photo WHERE pid IN (SELECT cover_pid FROM album WHERE owner ='要查的fbid' AND type = 'profile')


檢查是否是粉絲
SELECT page_id FROM page_fan WHERE uid = me() and page_id = '應用程式 ID / API 鑰匙'


撈某一id的大頭
SELECT pic_square FROM user WHERE uid =要查的fbid


http://developers.facebook.com/docs/reference/api/permissions/
允許頁


http://developers.facebook.com/tools/explorer
測試fql
/fql?q="你的fql"


Tag朋友


var _loc_2:* = new Array();//tag框框
_loc_2.push( { tag_uid:_fid, x:100, y:0} );
_loc_2.push( { tag_uid:_uid, x:0, y:0 } );
var _loc_3:Object = new Object();
_loc_3 = {message:_uname+'分享了一個好心情的禮物給 '+_fname+_stringPage._text.text+'轉個念頭轉個彎,一起擁有幸福好心情。'+('@'+_uname), fileName:"filename", image:bitmap, tags:JSON.encode(_loc_2)};
Facebook.api("/" +_uid + "/photos", this.onUploadCompleteHandler, _loc_3, "POST");



tag朋友附連結
"@[100000406220851:Name]"
_loc_5 = {message:"@["+uid+":Name]"+"和"+"@["+fbid+":Name]"+msg, fileName:"filename", image:_bitmap};

Fql排序
Facebook.fqlQuery("SELECT uid, name, pic_square  FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 ='" +uid + "')ORDER BY name", getFriend);






2 則留言:

  1. 讚耶~你好認真!!!
    我之前有用到FQLMultiQuery~
    抓相本跟相本封面,通常需要兩次FQL,FQL沒有支援join
    但用FQLMultiQuery可以一次就撈完
    var obj:Object = { query1: 'SELECT aid, name, object_id, cover_pid, cover_object_id FROM album WHERE owner = me() and photo_count > 0', query2: 'SELECT object_id, src_small,src_big FROM photo WHERE object_id IN (SELECT cover_object_id FROM #query1)' };

    var fqlMulti:FQLMultiQuery = new FQLMultiQuery();
    fqlMulti.queries = obj;
    Facebook.fqlMultiQuery(fqlMulti, getMyAlbumsHandler);

    結果就可以接到
    相本:result.query1
    相本的封面相片:result.query2

    回覆刪除
  2. 寫起來之後複製比較方便嘛!!!哈哈

    看了好久才了解啊!!真的很好用!
    不然都要先把相本ID先記起來多寫好多function
    謝謝啊!!!

    回覆刪除