no message
This commit is contained in:
parent
b8c9bc0be8
commit
a369047941
@ -3,6 +3,7 @@
|
|||||||
namespace App\Services\Tg;
|
namespace App\Services\Tg;
|
||||||
use App\Models\Config;
|
use App\Models\Config;
|
||||||
use App\Services\IM\Telegram;
|
use App\Services\IM\Telegram;
|
||||||
|
use App\Services\Tg\Http;
|
||||||
|
|
||||||
class Http {
|
class Http {
|
||||||
|
|
||||||
@ -11,8 +12,8 @@ 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 = "没有msg?", $aUpdate = [])
|
public function sendToTG($sMsg = "没有msg?", $aUpdate = [])
|
||||||
@ -28,7 +29,23 @@ class Http {
|
|||||||
|
|
||||||
} else {
|
} 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user