mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 17:40:07 +08:00
[add] Support bark notice push
This commit is contained in:
parent
de45364e5a
commit
ee9afc6635
@ -125,6 +125,28 @@ agent_id = ****
|
|||||||
to_user = UserId1|UserId2|UserId3
|
to_user = UserId1|UserId2|UserId3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**飞书**
|
||||||
|
|
||||||
|
> 文档: https://developers.dingtalk.com/document/robots/custom-robot-access
|
||||||
|
> 说明: 推送的AccessToken
|
||||||
|
|
||||||
|
```ini
|
||||||
|
; 飞书机器人/依赖USE_NOTIFY
|
||||||
|
[notify_feishu]
|
||||||
|
token =
|
||||||
|
```
|
||||||
|
|
||||||
|
**飞书**
|
||||||
|
|
||||||
|
> 文档: https://github.com/Finb/Bark
|
||||||
|
> 说明: 推送的AccessToken
|
||||||
|
|
||||||
|
```ini
|
||||||
|
; Bark/Token
|
||||||
|
[notify_bark]
|
||||||
|
token =
|
||||||
|
```
|
||||||
|
|
||||||
### 调试
|
### 调试
|
||||||
|
|
||||||
https://github.com/lkeme/BiliHelper-personal/blob/eb06f55fa0fa6cb07bbeffc7e85c6ac0bfaa67b3/data/latest_version.json#L8
|
https://github.com/lkeme/BiliHelper-personal/blob/eb06f55fa0fa6cb07bbeffc7e85c6ac0bfaa67b3/data/latest_version.json#L8
|
||||||
|
|||||||
@ -180,6 +180,10 @@ corp_secret =
|
|||||||
agent_id =
|
agent_id =
|
||||||
to_user =
|
to_user =
|
||||||
|
|
||||||
|
; Bark/Token
|
||||||
|
[notify_bark]
|
||||||
|
token =
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# 网络设置 #
|
# 网络设置 #
|
||||||
#######################
|
#######################
|
||||||
|
|||||||
@ -97,6 +97,9 @@ class Notice extends SingleTon
|
|||||||
if (getConf('notify_feishu.token')) {
|
if (getConf('notify_feishu.token')) {
|
||||||
$this->feiShuSend($info);
|
$this->feiShuSend($info);
|
||||||
}
|
}
|
||||||
|
if (getConf('notify_bark.token')) {
|
||||||
|
$this->bark($info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -471,6 +474,30 @@ class Notice extends SingleTon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bark Public 推送
|
||||||
|
* @doc https://github.com/Finb/Bark
|
||||||
|
* @param array $info
|
||||||
|
*/
|
||||||
|
protected function bark(array $info): void
|
||||||
|
{
|
||||||
|
Log::info('使用bark推送消息');
|
||||||
|
$url = 'https://api.day.app/' . getConf('notify_bark.token');
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'msgtype' => 'markdown',
|
||||||
|
'markdown' => [
|
||||||
|
'content' => "{$info['title']} \n\n{$info['content']}"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$raw = Request::put('other', $url, $payload, $this->headers);
|
||||||
|
$de_raw = json_decode($raw, true);
|
||||||
|
if ($de_raw['message'] == 'success') {
|
||||||
|
Log::notice("推送消息成功: {$de_raw['errmsg']}");
|
||||||
|
} else {
|
||||||
|
Log::warning("推送消息失败: $raw");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user