Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $config['GetAccessTokenCallback'] = function ($authorizer_appid) use ($config) {
$authorizer_refresh_token = ''; // 通过$authorizer_appid从数据库去找吧,在授权绑定的时候获取
$result = $open->refreshAccessToken($authorizer_appid, $authorizer_refresh_token);
if (empty($result['authorizer_access_token'])) {
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg'], '0');
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg']??'system error', '0');
}
$data = [
'authorizer_access_token' => $result['authorizer_access_token'],
Expand Down
8 changes: 4 additions & 4 deletions WeOpen/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getComponentAccessToken()
$url = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token';
$result = $this->httpPostForJson($url, $data);
if (empty($result['component_access_token'])) {
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
throw new InvalidResponseException($result['errmsg']??'system error', $result['errcode']??-1, $data);
}
Tools::setCache($cache, $result['component_access_token'], 7000);
return $result['component_access_token'];
Expand All @@ -122,7 +122,7 @@ public function getAuthorizerInfo($authorizerAppid)
];
$result = $this->httpPostForJson($url, $data);
if (empty($result['authorizer_info'])) {
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
throw new InvalidResponseException($result['errmsg']??'system error', $result['errcode']??-1, $data);
}
return $result['authorizer_info'];
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public function getQueryAuthorizerInfo($authCode = null)
];
$result = $this->httpPostForJson($url, $data);
if (empty($result['authorization_info'])) {
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
throw new InvalidResponseException($result['errmsg']??'system error', $result['errcode']??-1, $data);
}
$authorizerAppid = $result['authorization_info']['authorizer_appid'];
$authorizerAccessToken = $result['authorization_info']['authorizer_access_token'];
Expand Down Expand Up @@ -272,7 +272,7 @@ public function refreshAccessToken($authorizerAppid, $authorizerRefreshToken)
];
$result = $this->httpPostForJson($url, $data);
if (empty($result['authorizer_access_token'])) {
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
throw new InvalidResponseException($result['errmsg']??'system error', $result['errcode']??-1, $data);
}
// 缓存授权公众号访问 ACCESS_TOKEN
Tools::setCache("{$authorizerAppid}_access_token", $result['authorizer_access_token'], 7000);
Expand Down
2 changes: 1 addition & 1 deletion _test/open.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$authorizer_refresh_token = 'L5uFIa0U6KLalPyXckyqoVIJYLhsfrg8k9YzybZIHsx'; // 从数据库去找吧,在授权绑定的时候获取到了
$result = $open->refreshAccessToken($authorizer_appid, $authorizer_refresh_token);
if (empty($result['authorizer_access_token'])) {
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg'], '0');
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg']??'system error', '0');
}
$data = [
'authorizer_access_token' => $result['authorizer_access_token'],
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "library",
"name": "zoujingli/weopen-developer",
"name": "qfz9527/weopen-developer",
"homepage": "https://github.com/zoujingli/WeOpenDeveloper",
"description": "WeChat Open Platform Development",
"license": "MIT",
Expand Down