no message

This commit is contained in:
hellcat 2025-07-06 14:20:57 +08:00
parent 1b7b3565b5
commit 8a839687cc

View File

@ -2,6 +2,7 @@
namespace App\Services\Tg;
use App\Models\Config;
use App\Services\IM\Telegram;
class Http {
@ -10,19 +11,22 @@ class Http {
function __construct()
{
$this->sApiToken = Config::obtain('telegram_token');
$this->sApiChatId = Config::obtain('telegram_chatid');
// $this->sApiToken = Config::obtain('telegram_token');
// $this->sApiChatId = Config::obtain('telegram_chatid');
}
public function sendToTG($sMsg)
public function sendToTG($sMsg = "没有msg")
{
if ($_ENV['is_loc'] === true) {
echo "<pre>";
echo($sMsg);
} else {
$url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
file_get_contents($url);
(new Telegram())->send(0, $sMsg);
// $url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
// file_get_contents($url);
}
}