Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laravel队列中使用了SDK报Component verify ticket does not exists. #958

Closed
elinxer opened this issue Oct 13, 2017 · 6 comments
Closed

Comments

@elinxer
Copy link

elinxer commented Oct 13, 2017

我用的环境

PHP 版本:7.1
overtrue/wechat 版本:^3.1
是否使用了框架?框架名称:laravel5.5

问题及现象

做粉丝列表拉取得时候用到了laravel框架的队列,但发现在队列监听和执行中报ticket不存在,调试发现可以读取到ticket的key,但却无法获取ticket内容。
/** * 获取公众号授权APP句柄 * * @param $authorizerAppId * @param $authorizerRefreshToken * @return Application */ public function getMpAuthApp($authorizerAppId, $authorizerRefreshToken) { return $this->openPlatform->createAuthorizerApplication($authorizerAppId, $authorizerRefreshToken); }
再次调试发现,是php命令行下无法获取微信第三方平台下发的ticket,报Component verify ticket does not exists.

@elinxer
Copy link
Author

elinxer commented Oct 14, 2017

@overtrue

@mingyoung
Copy link
Collaborator

tinker 下有问题吗

@elinxer
Copy link
Author

elinxer commented Oct 14, 2017

没有的,tinker下一样获取不到呢,暂时找不问题所在 @mingyoung

@mingyoung mingyoung added the Bug label Oct 14, 2017
@mingyoung
Copy link
Collaborator

@elinxer
原因是因为不同环境下 sys_get_temp_dir() 获取到的临时目录不同。

可以设置自定义 cache 解决:

use EasyWeChat\Foundation\Application;
use Doctrine\Common\Cache\FilesystemCache; // 示例为 File 缓存

$app = new Application([
    'cache' => new FilesystemCache(storage_path('easywechat')), // storage_path 为 Laravel 函数
    'open_platform' => [
        // ...
    ]
]);

@elinxer
Copy link
Author

elinxer commented Oct 14, 2017

重新设置后,ticket使用正常,非常感谢!

@mingyoung
Copy link
Collaborator

😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants