template_id='ibTVb5-mUemyjvLYgQnYI6jpqFh_xQBtzLCb1xOQblQ'; // $this->url='http://admin.app.jiuweiyun.cn/#/team/zhengwei'; } /** * Handle the event. * * @param AgentAuditServiceListener $event * @return void */ public function handle(AgentAuditServiceEvent $event) { try{ $data=$event->data; $id=$data['id']; $app=app('wechat.official_account'); $phone=Warea::where('id',$id)->value('phone'); $user=User::where('mobile',$phone)->first(); if ($user->openid){ $app->template_message->send([ 'touser' => $user->openid, 'template_id' => $this->template_id, // 'url' => $this->url, 'data' => $data['data'] ]); } }catch (\Exception $exception){ Log::error('发送模板消息出错,出错内容为'.$exception); } } }