templateId='uZLksk1kr2EcmRMz4ybWex14YHJ0M0qtrMWGOKeOgf8'; $this->url='http://api.app.cliu.cc/api/gzh'; } public function handle(NewOrder $event) { try{ $data=$event->data; $openid=$data['openid']; $config=config('wechat.official_account.daweiboshi'); $app = Factory::officialAccount($config); $app->template_message->send([ 'touser' => $openid, 'template_id' => $this->templateId, 'url' => $this->url, 'data' => $data['data'], 'miniprogram' => [ //与公众号绑定的小程序(选传) 'appid' => config('wechat.mini_program.default.app_id'),//小程序id 'pagepath' => 'pages/order-manage/order-manage',//跳转页面 ], ]); }catch (\Exception $exception){ Log::error('发送模板消息出错,出错内容为'.$exception); } } }