公众号调用 用户信息报错:Request access_token fail: {"errcode":45009,"errmsg":"reach max api daily quota limit rid: 5f9fa45e-406cc3e2-135b88ce
$wechatConfig = [
'app_id' => 'wx54b86176e1f920ad',
'secret' => '92c858d807d68f1a1ce85f8d48326051',
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => DOCROOT . '/log/wechat.log',
],
];
$newapp = Factory::officialAccount($wechatConfig);
$res3 = $newapp->user->list();这里总是报错
报错提示:
{
"status": 500,
"msg": "exception.EasyWeChat\Kernel\Exceptions\HttpException",
"exception": "Request access_token fail: {"errcode":45009,"errmsg":"reach max api daily quota limit rid: 5f9fa45e-406cc3e2-135b88ce"};\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/AccessToken.php 第171行;追溯:\n1.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/AccessToken.php 第114行:EasyWeChat\Kernel\AccessToken->requestToken;\n2.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/AccessToken.php 第235行:EasyWeChat\Kernel\AccessToken->getToken;\n3.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/AccessToken.php 第192行:EasyWeChat\Kernel\AccessToken->getQuery;\n4.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/BaseClient.php 第228行:EasyWeChat\Kernel\AccessToken->applyToRequest;\n5.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/RetryMiddleware.php 第67行:EasyWeChat\Kernel\BaseClient->EasyWeChat\Kernel\{closure};\n6.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/PrepareBodyMiddleware.php 第66行:GuzzleHttp\RetryMiddleware->__invoke;\n7.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/Middleware.php 第30行:GuzzleHttp\PrepareBodyMiddleware->__invoke;\n8.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/RedirectMiddleware.php 第70行:GuzzleHttp\Middleware::GuzzleHttp\{closure};\n9.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/Middleware.php 第59行:GuzzleHttp\RedirectMiddleware->__invoke;\n10.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/HandlerStack.php 第67行:GuzzleHttp\Middleware::GuzzleHttp\{closure};\n11.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/Client.php 第277行:GuzzleHttp\HandlerStack->__invoke;\n12.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/Client.php 第125行:GuzzleHttp\Client->transfer;\n13.\/var\/www\/test.aysk.com\/vendor\/guzzlehttp\/guzzle\/src\/Client.php 第131行:GuzzleHttp\Client->requestAsync;\n14.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/Traits\/HasHttpRequests.php 第150行:GuzzleHttp\Client->request;\n15.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/BaseClient.php 第172行:EasyWeChat\Kernel\BaseClient->performRequest;\n16.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/Kernel\/BaseClient.php 第103行:EasyWeChat\Kernel\BaseClient->request;\n17.\/var\/www\/test.aysk.com\/vendor\/overtrue\/wechat\/src\/OfficialAccount\/TemplateMessage\/Client.php 第127行:EasyWeChat\Kernel\BaseClient->httpPostJson;\n18.\/var\/www\/test.aysk.com\/services\/professional\/elevator\/elevator.php 第273行:EasyWeChat\OfficialAccount\TemplateMessage\Client->send;\n19.\/var\/www\/test.aysk.com\/framework\/base\/service.php 第224行:Services\Professional\Elevator\Elevator->sendTemplateMessage;\n20.\/var\/www\/test.aysk.com\/controller\/restapi\/professional\/weapp\/maintenance.php 第284行:Service->__call;\n21.\/var\/www\/test.aysk.com\/controller\/restapi\/professional\/weapp\/maintenance.php 第77行:Controller\Restapi\Professional\Weapp\Maintenance->addInfo;\n22.\/var\/www\/test.aysk.com\/framework\/route\/dispatch.php 第125行:Controller\Restapi\Professional\Weapp\Maintenance->actionPOST;\n23.\/var\/www\/test.aysk.com\/framework\/route\/dispatch.php 第55行:Framework\Route\Dispatch::_dispatch;\n24.\/var\/www\/test.aysk.com\/public\/index.php 第8行:Framework\Route\Dispatch::run;"
}
access_token每天只能调用2000次。
access_token调用次数是有日限的。
access_token的有效期是2个小时,建议存起来。
可以做个定时刷新,在access_token快过期时重新获取;或者使用的时候发现access_token过期了立即刷新。