easy-swoole/wechat

修改为调用push方法后仍然无法返回News类型消息。希望认真再看看。

ximenhuangguaduo opened this issue · 0 comments

// 注册收到文本消息事件
$server->onMessage()->set(RequestConst::MSG_TYPE_TEXT, function (RequestMsg $msg) {
$nickname = '奥利奥';
$reply = new News();
// 下面两句经过反复调整,依然无效
// $reply->setFromUserName($msg->getToUserName());
// $reply->setToUserName($msg->getFromUserName());
$news = new NewsItem();
$news->setTitle("{$nickname},我们已经开通了家长专属直播间,点击进入");
$news->setDescription("家长好好学习,孩子天天向上");
$news->setPicUrl('http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg');
$news->setUrl('https://www.baidu.com');
$reply->push($news);
# var_dump($reply);
return $reply;
});