|
还是不能获取到unoinid!
可以参考我的实现:
- var qq = api.require('QQPlus');
- qq.login(function(ret,err){
- if(ret){
- if(ret.unionid){//没返回unionid
- $api.setStorage('qqUnionId',ret.unionid);
- }else{
- api.ajax({
- url : "https://graph**.**/oauth2.0/me",
- method : 'get',
- timeout : 30,
- dataType : 'text',
- cache : false,
- returnAll : false,
- data : {
- values : {
- access_token:ret.accessToken,
- unionid:1
- }
- },
- }, function(r, e) {
- r = eval(r.replace("callback",""));
- if(r.unionid){
- $api.setStorage('qqUnionId',r.unionid);
- }
- });
- }
- }else{
- mAlert(err.msg)
- }
- });
复制代码 |
|