From a12096f4cb2dec6601c9dd1f684fc4149abaa5ce Mon Sep 17 00:00:00 2001 From: zyimm Date: Thu, 8 Dec 2022 17:05:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- publish/message_notify.php | 2 +- src/Notify.php | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7023099..f5b0a1f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ composer require tm-wms/message-notify ## 配置文件 -发布配置文件`config/message_notify.php` +发布配置文件`config/message_notify.php` 具体配置message_notify.php ```sh php bin/hyperf.php vendor:publish tm-wms/message-notify diff --git a/publish/message_notify.php b/publish/message_notify.php index 61ca2db..3f17855 100644 --- a/publish/message_notify.php +++ b/publish/message_notify.php @@ -19,7 +19,7 @@ return [ Notify::INFO => [ 'token' => env('NOTIFY_DINGTALK_TOKEN', ''), 'secret' => env('NOTIFY_DINGTALK_SECRET', ''), - 'keyword' => env('NOTIFY_DINGTALK_KEYWORD', ['test']), + 'keyword' => env('NOTIFY_DINGTALK_KEYWORD', ['']), ], // 错误信息告警群 Notify::ERROR => [ diff --git a/src/Notify.php b/src/Notify.php index 57c66fc..9e6d5d3 100644 --- a/src/Notify.php +++ b/src/Notify.php @@ -26,6 +26,9 @@ class Notify public static function make(?AbstractChannel $channel = null): Connection { + $default = env('NOTIFY_DEFAULT_CHANNEL'); + $channels = config('message_notify.channels'); + $channel = $channel ?? make($channels[$default]['channel'] ?? null); return make(Connection::class, [ $channel ]);