From c02656e43570438f890a5ae6477a81c7d2e72065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=99=BB=E5=B3=B0?= Date: Fri, 12 Jul 2019 18:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=96=87=E4=BB=B6=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/functions.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/functions.php b/src/functions.php index 86315a3..87a7fc8 100644 --- a/src/functions.php +++ b/src/functions.php @@ -308,5 +308,34 @@ function chat_image_alert ($chat, $media_id) return null; } + return $resp; +} + +/** + * 对企业微信群发送报警文件(需先创建 + * + * @param $chat + * @param $media_id + * + * @return mixed|null + */ + +function chat_file_alert ($chat, $media_id) +{ + if (env('APP_ENV') == 'local') { + return true; + } + $base_client = new \JsonRpc\Client(RPC_CONFIG); + $client = $base_client->endpoint('auth'); + + try { + $resp = $client->call('notify.file', [ + ['chat' => $chat], + $media_id, + ]); + } catch (Exception $ex) { + return null; + } + return $resp; } \ No newline at end of file