From cdbc72b7743d70fc96565a277209cc2a5d6163b8 Mon Sep 17 00:00:00 2001 From: lio990527 Date: Fri, 19 Nov 2021 17:56:08 +0800 Subject: [PATCH] fix bug --- src/Channels/WechatTemplateChannel.php | 2 +- src/Messages/WechatWorkMessage.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Channels/WechatTemplateChannel.php b/src/Channels/WechatTemplateChannel.php index 3e01b63..fa8f13a 100644 --- a/src/Channels/WechatTemplateChannel.php +++ b/src/Channels/WechatTemplateChannel.php @@ -23,7 +23,7 @@ public function send($notifiable, Notification $notification) $message = $notification->{'to' . Str::studly($this->channel)}($notifiable); if ($message instanceof WechatTemplateMessage && ! Arr::get($message->getMessage(), 'touser')) { $message->to($notifiable->routeNotificationFor($this->channel, $notification)); - } elseif ($message instanceof WechatWorkMessage && empty($message->to)) { + } elseif ($message instanceof WechatWorkMessage && empty($message->getToUser())) { $message->toUser($notifiable->routeNotificationFor($this->channel, $notification)); } return $message->send(); diff --git a/src/Messages/WechatWorkMessage.php b/src/Messages/WechatWorkMessage.php index faecd8d..06ea354 100644 --- a/src/Messages/WechatWorkMessage.php +++ b/src/Messages/WechatWorkMessage.php @@ -13,5 +13,9 @@ public function __construct($app) parent::__construct($app); } + public function getToUser() + { + return $this->to; + } }