mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
Merge branch 'master' of https://github.com/lkeme/BiliHelper-personal
This commit is contained in:
commit
a406e674b1
@ -209,6 +209,10 @@ url = ""
|
||||
token =
|
||||
target_qq =
|
||||
|
||||
; 飞书机器人|依赖USE_NOTIFY
|
||||
[notify.feishu]
|
||||
token =
|
||||
|
||||
; Debug|个人调试推送|url|token
|
||||
[notify.debug]
|
||||
url = ""
|
||||
|
||||
@ -28,7 +28,7 @@ class Env
|
||||
public function __construct()
|
||||
{
|
||||
set_time_limit(0);
|
||||
header("Content-Type:text/html; charset=utf-8");
|
||||
// header("Content-Type:text/html; charset=utf-8");
|
||||
// ini_set('date.timezone', 'Asia/Shanghai');
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
ini_set('display_errors', 'on');
|
||||
|
||||
@ -171,6 +171,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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -419,4 +422,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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user