12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Listeners;
- use App\Events\AgentAuditEvent;
- use Illuminate\Queue\Listener;
- use Illuminate\Support\Facades\Log;
- class AgentAuditListener {
- protected $template_id;
- protected $url;
- //认证审核通知 通知上级 和 邀请人 审核结果
- public function __construct()
- {
- $this->template_id='ibTVb5-mUemyjvLYgQnYI6jpqFh_xQBtzLCb1xOQblQ';
- $this->url='http://api.app.jiuweiyun.cn/api/gzh';
- }
- /**
- * Handle the event.
- *
- * @param WechatMessageEvent $event
- * @return void
- */
- public function handle(AgentAuditEvent $event)
- {
- Log::error(1);
- Log::error(json_encode($event));
- try{
- $data=$event->data;
- $openid=$data['openid'];
- $app=app('wechat.official_account');
- $app->template_message->send([
- 'touser' => $openid,
- 'template_id' => $this->template_id,
- 'url' => $this->url,
- 'data' => $data['data']
- ]);
- }catch (\Exception $exception){
- Log::error('发送模板消息出错,出错内容为'.$exception);
- }
- }
- }
|