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

开放平台:组件ticket无法通过 #904

Closed
liuyami opened this issue Sep 2, 2017 · 7 comments
Closed

开放平台:组件ticket无法通过 #904

liuyami opened this issue Sep 2, 2017 · 7 comments

Comments

@liuyami
Copy link

liuyami commented Sep 2, 2017

ubuntu 14.04

PHP 版本:7.0.14
overtrue/wechat 版本:3.3

问题及现象

按照手册“开放平台”部分,目前接收公众号授权什么都成功,但是一在微信开放平台选择全网发布,就提示:组件ticket正确接收

wx20170903-010221

请教如何解决

@liuyami liuyami changed the title 开放平台:组件ticket无法正确接收 开放平台:组件ticket无法通过 Sep 2, 2017
@mingyoung
Copy link
Collaborator

mingyoung commented Sep 2, 2017 via email

@liuyami
Copy link
Author

liuyami commented Sep 3, 2017

你好,我那部分代码完全是按照官网手册那样写的,

        $server->setMessageHandler(function($event) use ($openPlatform) {
    
            addlog('收到推送');

            switch ($event->InfoType) {
                
                case Guard::EVENT_AUTHORIZED: // 授权成功
                    try {
                        //数据库操作
    
                        addlog('新增授权:'.$authorizer_appid);

                    } catch (\Exception $e) {
                        addlog('error:' . $e->getMessage());
                    }

                    
                case Guard::EVENT_UPDATE_AUTHORIZED: // 更新授权
                    //addlog('进入权限更新');
                    
                    // 更新数据库操作
                    
                    addlog('更新授权:'.$authorizer_appid);
                    

    
    
                case Guard::EVENT_UNAUTHORIZED: // 授权取消
                   // 更新数据库操作
    
                    addlog('取消授权:'.$authorizer_appid);

                    
                default:
                    http(403,'BAD REQUEST');
            }
        });

@mingyoung 新增、更新、取消都有 SQL 数据库操作,并且都测试过正常没有报错。

@mingyoung
Copy link
Collaborator

最后有返回(输出)内容给微信了么?

@liuyami
Copy link
Author

liuyami commented Sep 3, 2017

有的,前面发的代码后面就是

        $response = $server->serve();
        $response->send();

@mingyoung
Copy link
Collaborator

mingyoung commented Sep 3, 2017

4、模拟推送component_verify_ticket给开发者,开发者需按要求回复(接收到后必须直接返回字符串success)

检查下最后的返回结果内容是不是 success ?

@liuyami
Copy link
Author

liuyami commented Sep 3, 2017

请教一下,这个如何模拟,用post发送component_verify_ticket字段似乎不行

@liuyami
Copy link
Author

liuyami commented Sep 3, 2017

@mingyoung 不好意思,我自己有一处弄错了,还是非常感谢

@liuyami liuyami closed this as completed Sep 3, 2017
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