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

测试公众号无法接受用户信息 #911

Closed
NominationP opened this issue Sep 7, 2017 · 0 comments
Closed

测试公众号无法接受用户信息 #911

NominationP opened this issue Sep 7, 2017 · 0 comments

Comments

@NominationP
Copy link

NominationP commented Sep 7, 2017

我用的环境

PHP 版本:7.0
overtrue/wechat 版本:3.1
微信公众号:测试公众号

问题及现象

背景:

之前用的docker端口号不是80失败,用nginx反向代理设置了一下,验证成功了

###问题
其他接口包括群发信息都可以成功,唯有用户发送的消息接收不到
发送消息,显示:这个微信公众号暂不可用

function __construct(){

    	$this->curl = new cURL;

    	$options = [
    	    'debug'  => true,
    	    'app_id' => 'wxd9506eba5719b9a7',
    	    'secret' => 'a27454a19fa4357a1823563891296635',
    	    'token'  => 'easywechat',
    	    // 'aes_key' => null, // 可选
    	    'log' => [
            'level'      => 'debug',
            // 'permission' => 0777,
            'file'       => '/var/www/easywechat.log',
    	    ],
    	    //...
    	];

    	$this->app = new Application($options);


	}

	public function server(){

Log::info("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww");

		// 从项目实例中得到服务端应用实例。
		$server = $this->app->server;

Log::info("进");

		$server->setMessageHandler(function ($message) {
Log::info("进不来");

        switch ($message->MsgType) {
            case 'event':
                return '收到事件消息';
                break;
            case 'text':
                return '收到文字消息';
                break;
            case 'image':
                return '收到图片消息';
                break;
            case 'voice':
                return '收到语音消息';
                break;
            case 'video':
                return '收到视频消息';
                break;
            case 'location':
                return '收到坐标消息';
                break;
            case 'link':
                return '收到链接消息';
                break;
            // ... 其它消息
            default:
                return '收到其它消息';
                break;
        }

Log::info("直接到这儿了");
		$response = $server->serve();
		// $response->send(); // Laravel 里请使用:return $response;
		return $response;

	}

easywechat.log

验证时候的日志

2017-09-07 01:52:39] easywechat.DEBUG: Current config: {"debug":true,"app_id":"***9b9a7","secret":"***96635","token":"easywechat","log":{"level":"debug","permission":511,"file":"/var/www/easywechat.log"}} []
[2017-09-07 01:52:39] easywechat.DEBUG: Request received: {"Method":"GET","URI":"/server?signature=7d5e18cc6a4f56da6247bea1de4e8238874b4f98&echostr=6797706790880472823&timestamp=1504749159&nonce=860456562","Query":"echostr=6797706790880472823&nonce=860456562&signature=7d5e18cc6a4f56da6247bea1de4e8238874b4f98&timestamp=1504749159","Protocal":"HTTP/1.0","Content":""} []
[2017-09-07 01:52:39] easywechat.DEBUG: Output 'echostr' is '6797706790880472823'. [] []

用户发消息时候的日志,因该是没有接受到信息?

[2017-09-07 01:54:05] easywechat.DEBUG: Current config: {"debug":true,"app_id":"***9b9a7","secret":"***96635","token":"easywechat","log":{"level":"debug","file":"/var/www/easywechat.log"}} []
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

1 participant