mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-20 02:20:06 +08:00
commit
a76cdd1c85
@ -184,6 +184,11 @@ to_user =
|
|||||||
[notify_bark]
|
[notify_bark]
|
||||||
token =
|
token =
|
||||||
|
|
||||||
|
; PushDeer/服务器地址/token
|
||||||
|
[notify_push_deer]
|
||||||
|
url =
|
||||||
|
token =
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# 网络设置 #
|
# 网络设置 #
|
||||||
#######################
|
#######################
|
||||||
|
|||||||
@ -100,6 +100,9 @@ class Notice extends SingleTon
|
|||||||
if (getConf('notify_bark.token')) {
|
if (getConf('notify_bark.token')) {
|
||||||
$this->bark($info);
|
$this->bark($info);
|
||||||
}
|
}
|
||||||
|
if (getConf('notify_push_deer.token')) {
|
||||||
|
$this->pushDeer($info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -499,5 +502,31 @@ class Notice extends SingleTon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function pushDeer(array $info)
|
||||||
|
{
|
||||||
|
Log::info('使用 PushDeer 推送消息');
|
||||||
|
$token = getConf('notify_push_deer.token');
|
||||||
|
$url = getConf('notify_push_deer.url');
|
||||||
|
if (!str_contains($url, "http")){
|
||||||
|
$url = "https://api2.pushdeer.com/message/push";
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
"text" => $info['title'],
|
||||||
|
"desp" => $info['content'],
|
||||||
|
"pushkey" => $token
|
||||||
|
];
|
||||||
|
|
||||||
|
$raw = Request::post('other', $url, $payload, [
|
||||||
|
'Content-Type' => 'application/x-www-form-urlencoded'
|
||||||
|
]);
|
||||||
|
$de_raw = json_decode($raw, true);
|
||||||
|
if ($de_raw['code'] == 0){
|
||||||
|
Log::notice("推送消息成功: {$de_raw['content']['result'][0]}");
|
||||||
|
} else {
|
||||||
|
Log::warning("推送消息失败: $raw");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user