template_id='6fKG5UML7jpoQ6p43vV3InYiwH2rLWNVMwSsfSNio3U'; // $this->template_id='szXa-NqOvLHxXzIWqkwB0HiFS3Dp3vz38KXq2nCGDiQ'; // $this->template_id='VQY91hiknlZvhTEGfj8fCXb3Jp9ZsM0jeYD9QJ1Osjg'; $this->url='http://api.app.cliu.cc/api/gzh'; } public function handle(UserMessageEvent $event) { try{ $data=$event->data; $openid=$data['openid']; $app=app('wechat.official_account'); $a=$app->template_message->send([ 'touser' => $openid, 'template_id' => $this->template_id, 'url' => $this->url, 'data' => $data['data'] ]); Log::info(json_encode($a,JSON_UNESCAPED_UNICODE)); }catch (\Exception $exception){ Log::error('发送模板消息出错,出错内容为'.$exception); } } }