diff --git a/src/Services/Tg/Http.php b/src/Services/Tg/Http.php index a9051615..79207a59 100644 --- a/src/Services/Tg/Http.php +++ b/src/Services/Tg/Http.php @@ -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 "
";
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);
}
}