no message
This commit is contained in:
parent
1b7b3565b5
commit
8a839687cc
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services\Tg;
|
namespace App\Services\Tg;
|
||||||
use App\Models\Config;
|
use App\Models\Config;
|
||||||
|
use App\Services\IM\Telegram;
|
||||||
|
|
||||||
class Http {
|
class Http {
|
||||||
|
|
||||||
@ -10,19 +11,22 @@ class Http {
|
|||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->sApiToken = Config::obtain('telegram_token');
|
// $this->sApiToken = Config::obtain('telegram_token');
|
||||||
$this->sApiChatId = Config::obtain('telegram_chatid');
|
// $this->sApiChatId = Config::obtain('telegram_chatid');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendToTG($sMsg)
|
public function sendToTG($sMsg = "没有msg?")
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($_ENV['is_loc'] === true) {
|
if ($_ENV['is_loc'] === true) {
|
||||||
echo "<pre>";
|
echo "<pre>";
|
||||||
echo($sMsg);
|
echo($sMsg);
|
||||||
} else {
|
} 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user