From a36904794152e48de82e3a30ae0d90a09b7aa5d9 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Thu, 10 Jul 2025 16:58:10 +0800 Subject: [PATCH] no message --- src/Services/Tg/Http.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Services/Tg/Http.php b/src/Services/Tg/Http.php index 328d81d3..6a74d524 100644 --- a/src/Services/Tg/Http.php +++ b/src/Services/Tg/Http.php @@ -3,6 +3,7 @@ namespace App\Services\Tg; use App\Models\Config; use App\Services\IM\Telegram; +use App\Services\Tg\Http; class Http { @@ -11,8 +12,8 @@ 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 = "没有msg?", $aUpdate = []) @@ -28,7 +29,23 @@ class Http { } else { - (new Telegram())->send(0, $sMsg); + $oHttp = new Http(); + $oHttp->sMethod = "post"; + $oHttp->sToUrl = "https://api.telegram.org/bot$this->sApiToken/sendMessage"; +// $oHttp->bIsJson = true; + $oHttp->aData = [ + "chat_id" => $this->sApiChatId, + "text" => $sMsg + ]; + + $oHttp->send(); + + + + + + +// (new Telegram())->send(0, $sMsg); }