QQ互联目前获取到的都是qquser,无法获取到正常的QQ昵称
解决方法
1.打开source/plugin/qqconnect/lib/ConnectOAuth.php
2.搜索代码,大约在409行
public function connectGetUserInfo_V2($openId, $accessToken) { $params = array( 'access_token' => $accessToken, 'oauth_consumer_key' => $this->_appKey, 'openid' => $openId, 'format' => 'xml' ); require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php'; $utilService = new Cloud_Service_Util(); $response = $this->dfsockopen($this->_getUserInfoURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&')); $data = $this->_xmlParse($response); if(isset($data['ret']) && $data['ret'] == 0) { return $data; } else { throw new Exception($data['msg'], $data['ret']); } }
修改为
public function connectGetUserInfo_V2($openId, $accessToken) { $params = array( 'access_token' => $accessToken, 'oauth_consumer_key' => $this->_appKey, 'openid' => $openId, ); require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php'; $utilService = new Cloud_Service_Util(); $response = $this->dfsockopen($this->_getUserInfoURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&')); $data = json_decode($response,true); $response = $this->_iconv($response, 'UTF-8', CHARSET); if(isset($data['ret']) && $data['ret'] == 0) { return $data; } else { throw new Exception($data['msg'], $data['ret']); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。