This commit is contained in:
zyimm 2022-12-08 17:05:25 +08:00
parent e5e927ae6a
commit a12096f4cb
3 changed files with 5 additions and 2 deletions

View File

@ -28,7 +28,7 @@ composer require tm-wms/message-notify
## 配置文件 ## 配置文件
发布配置文件`config/message_notify.php` 发布配置文件`config/message_notify.php` 具体配置message_notify.php
```sh ```sh
php bin/hyperf.php vendor:publish tm-wms/message-notify php bin/hyperf.php vendor:publish tm-wms/message-notify

View File

@ -19,7 +19,7 @@ return [
Notify::INFO => [ Notify::INFO => [
'token' => env('NOTIFY_DINGTALK_TOKEN', ''), 'token' => env('NOTIFY_DINGTALK_TOKEN', ''),
'secret' => env('NOTIFY_DINGTALK_SECRET', ''), 'secret' => env('NOTIFY_DINGTALK_SECRET', ''),
'keyword' => env('NOTIFY_DINGTALK_KEYWORD', ['test']), 'keyword' => env('NOTIFY_DINGTALK_KEYWORD', ['']),
], ],
// 错误信息告警群 // 错误信息告警群
Notify::ERROR => [ Notify::ERROR => [

View File

@ -26,6 +26,9 @@ class Notify
public static function make(?AbstractChannel $channel = null): Connection 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, [ return make(Connection::class, [
$channel $channel
]); ]);