template_id='eeNJUDz0Pn32JuF3kQ165NA_pNSvNeUCNrbmtiJNb0c'; $this->template_id='3PGRr84zGsleaJYLqQjgr6G9XAmCLjC2YmardI6RBAo'; $this->url='http://api.app.jiuweiyun.cn/api/gzh'; // $this->template_id='eeNJUDz0Pn32JuF3kQ165NA_pNSvNeUCNrbmtiJNb0c'; // $this->url='http://api.woaidakele.cn/api/gzh'; } public function handle(OrderPay $event) { try{ $data=$event->data; $openid=$data['openid']; $config=config('wechat.official_account.default'); $app = Factory::officialAccount($config); $app->template_message->send([ 'touser' => $openid, 'template_id' => $this->template_id, 'url' => $this->url, 'data' => $data['data'] ]); }catch (\Exception $exception){ Log::error('发送模板消息出错,出错内容为'.$exception); } } }