ZoDream Document

文档:微信开发

wechat

微信公众号开发

微信公众号

配置

'wechat' => [
    'appid' => '',
    'token' => '',
    'aes_key' => '',
    'secret' => '',
    'redirect_uri' => '',
    'platform' => [  // 第三方平台配置
        'component_appid' => '',
        'aes_key' => '',
        'token' => '',
        'component_appSecret' => ''
    ]
]

消自定义菜单

获取菜单

(new Menu())->menuList();

设置菜单

(new Menu())->create(
    MenuItem::menu(MenuItem::name('网址')->setUrl('http://zodream.cn'))
        ->setMenu(
            MenuItem::menu(MenuItem::name('点击')->setKey(1))
            ->setMenu(MenuItem::name('点击')->setKey(1))
        )
        ->setMenu(MenuItem::name('查看')->setMediaId('132123123'))
);

删除全部菜单

(new Menu())->deleteMenu();

消息被动接收回复

$message = new Message();
return $message->on([EventEnum::ScanSubscribe, EventEnum::Subscribe],
    function(Message $message, MessageResponse $response) {
    $response->setText('谢谢关注!');
})->on(EventEnum::Message, function(Message $message, MessageResponse $response) {
    $response->setText(sprintf('您的消息是: %s', $message->content));
})->on(EventEnum::UnSubscribe, function(Message $message, MessageResponse $response) {
    $response->setText('取消关注');
})->on(EventEnum::Click, function(Message $message, MessageResponse $response) {
    $response->setText(sprintf('您点击了 %s', $message->eventKey));
})->run()->sendContent();

微信公众号第三方平台

事件推送

管理

授权登录