Files
ProxyPanel/app/Channels/PushBearChannel.php
兔姬桑 12d4365fe4 Bark & 企业微信 等显示调整优化
Apply fixes from StyleCI
2022-01-16 22:57:48 +08:00

39 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Channels;
use Helpers;
use Http;
use Illuminate\Notifications\Notification;
use Log;
class PushBearChannel
{
public function send($notifiable, Notification $notification)
{
$message = $notification->toCustom($notifiable);
$response = Http::timeout(15)->get('https://pushbear.ftqq.com/sub', [
'sendkey' => sysConfig('push_bear_send_key'),
'text' => $message['title'],
'desp' => $message['content'],
]);
if ($response->ok()) {
$ret = $response->json();
// 发送成功
if ($ret) {
Helpers::addMarketing(2, $message['title'], $message['content']);
return $ret;
}
// 发送失败
Helpers::addMarketing(2, $message['title'], $message['content'], -1, '无返回内容');
return false;
}
// 发送错误
Log::critical('PushBear消息推送异常'.var_export($response, true));
return false;
}
}