参考代码1:


 

var query = FB.Data.query('select uid, first_name, last_name, work, from user where uid={0}', response.id);

query.wait(
function(rows) {
var loginData = {fb_uid: rows[0].uid, 
                first_name: rows[
0].first_name,
                last_name: rows[
0].last_name,
                employer: rows[
0].work[0].employer.name,
                position: rows[
0].work[0].position.name
    };
}

 

 

参考代码2:

 

 

var query1 = FB.Data.query('select name,uid,birthday,contact_email,birthday_date,sex,status,current_location,wall_count from user where uid=me()'); ///通过uId得到用户资料
                //var query2 = FB.Data.query('select uid2 from friend where uid1=me()');
                //当uid1=uid2时,为朋友,通过uid1=me时,得到uid2
                query1.wait(function(msg) {
                    
if (msg[0].sex == "")
                    {
                        sex 
= "u";
                        sex1 
= 3;
                    }
                    
else if (msg[0].sex == "male")
                    {
                        sex 
= "m";
                        sex1 
= 1;
                    }
                    
else
                    {
                        sex 
= "f";
                        sex1 
= 0;
                    }
                    
if (msg[0].current_location != null) {
                        city 
= msg[0].current_location.city || "null";
                        country 
= msg[0].current_location.country || "null";
                        state 
= msg[0].current_location.state || "null";
                        zip 
= msg[0].current_location.zip || "null";
                    }
                    count 
= msg[0].length || 0;
                    
if (msg[0].contact_email != null) {
                        contact_email 
= msg[0].contact_email;
                    }
                    
//给PHP传统计
                    if (window.location.search.indexOf("&installed=1"!= -1)
                    {
                        $.ajax({
                            url:that.Config.statisticsPHPUrl,
                            data:{
"sex":sex1,"email":contact_email},
                            success:
function(data) {
                                
if (data.result) { //成功
                                } else {//不成功
                                }
                            }
                        });
                    }

                });

 

 

 

 

 

 

 

posted on 2011-07-04 16:49  小炒花生米  阅读(381)  评论(0编辑  收藏  举报