From 515519c5cf1a38bfc34b7b375b70b17e624eaa44 Mon Sep 17 00:00:00 2001 From: DishesDog <794329728@qq.com> Date: Thu, 27 Jan 2022 18:06:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[add]=20=E6=B7=BB=E5=8A=A0=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugin/Notice.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/plugin/Notice.php b/src/plugin/Notice.php index 4c60b1a..33858e1 100644 --- a/src/plugin/Notice.php +++ b/src/plugin/Notice.php @@ -167,6 +167,9 @@ class Notice if (getConf('corp_id', 'notify.we_com_app') && getConf('corp_secret', 'notify.we_com_app') && getConf('agent_id', 'notify.we_com_app')) { self::weComApp($info); } + if (getConf('token', 'notify.feishu')) { + self::feiShuSend($info); + } } /** @@ -415,4 +418,32 @@ class Notice } } + + /** + * @use 飞书推送 + * @doc https://developers.dingtalk.com/document/robots/custom-robot-access + * @param array $info + */ + private static function feiShuSend(array $info) + { + Log::info('使用飞书webhook机器人推送消息'); + $url = 'https://open.feishu.cn/open-apis/bot/v2/hook/' . getConf('token', 'notify.feishu'); + $payload = [ + 'msg_type' => 'text', + 'content' => [ + 'text' => $info['title'] . $info['content'], + ] + ]; + $headers = [ + 'Content-Type' => 'application/json;charset=utf-8' + ]; + $raw = Curl::put('other', $url, $payload, $headers); + $de_raw = json_decode($raw, true); + if ($de_raw['StatusCode'] == 0) { + Log::notice("推送消息成功: {$de_raw['StatusCode']}"); + } else { + Log::warning("推送消息失败: $raw"); + } + } + } \ No newline at end of file From 6333b8735744a4dde281fa25438565b02546229e Mon Sep 17 00:00:00 2001 From: DishesDog <794329728@qq.com> Date: Thu, 27 Jan 2022 18:06:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[add]=20=E6=B7=BB=E5=8A=A0=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/user.ini.example | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/user.ini.example b/conf/user.ini.example index 2504a6e..7725a0e 100644 --- a/conf/user.ini.example +++ b/conf/user.ini.example @@ -209,6 +209,10 @@ url = "" token = target_qq = +; 飞书机器人|依赖USE_NOTIFY +[notify.feishu] +token = 15a2bc73-a1da-4152-a08d-0870e938f97f + ; Debug|个人调试推送|url|token [notify.debug] url = "" From a894b1f3b795ead6c24991cefe5e2fddbd1a1336 Mon Sep 17 00:00:00 2001 From: DishesDog <794329728@qq.com> Date: Thu, 27 Jan 2022 18:07:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[add]=20=E6=B7=BB=E5=8A=A0=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/user.ini.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/user.ini.example b/conf/user.ini.example index 7725a0e..61262d5 100644 --- a/conf/user.ini.example +++ b/conf/user.ini.example @@ -211,7 +211,7 @@ target_qq = ; 飞书机器人|依赖USE_NOTIFY [notify.feishu] -token = 15a2bc73-a1da-4152-a08d-0870e938f97f +token = ; Debug|个人调试推送|url|token [notify.debug]