template_id='FgZJgH06B14FqD1DtiKiUYDQTTgMfOCsL05qWUXkU74'; //测试 // $this->template_id='a9fxKufmVgDAxqMYz_RbiuII91vsJyyD7XRVGcONHk4'; $this->url='http://api.app.cliu.cc/api/gzh'; // $this->url='http://api.woaidakele.cn/api/gzh'; //测试 } /** * Handle the event. * * @param OrderPayInfoEvent $event * @return void */ public function handle(OrderPayInfoEvent $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); } } }