no message
This commit is contained in:
parent
e28c577d7e
commit
41e0a5d1d4
@ -28,11 +28,11 @@ final class HookController
|
||||
$aData['chatId'] = $aUpdate["message"]["chat"]["id"];
|
||||
$aData['fromId'] = $aUpdate["message"]["from"]["id"];
|
||||
|
||||
$mSendType = false;
|
||||
|
||||
if (isset($aUpdate["is_dove"])) {
|
||||
$mSendType = "dove";
|
||||
}
|
||||
// $mSendType = false;
|
||||
//
|
||||
// if (isset($aUpdate["is_dove"])) {
|
||||
// $mSendType = "dove";
|
||||
// }
|
||||
|
||||
// tomd($mSendType, 1);
|
||||
|
||||
@ -81,10 +81,10 @@ final class HookController
|
||||
// 返回可以是数组
|
||||
if (is_array($r)) {
|
||||
foreach ($r as $row) {
|
||||
$oTGHttp->sendToTG($row, $mSendType);
|
||||
$oTGHttp->sendToTG($row, $aUpdate);
|
||||
}
|
||||
} else {
|
||||
$oTGHttp->sendToTG($r, $mSendType);
|
||||
$oTGHttp->sendToTG($r, $aUpdate);
|
||||
}
|
||||
|
||||
Http::response(200);
|
||||
@ -97,7 +97,7 @@ final class HookController
|
||||
} catch (\Throwable $e) {
|
||||
$sMessage = "错误(line:".$e->getLine()."): " . $e->getMessage();
|
||||
|
||||
$oTGHttp->sendToTG($sMessage, $mSendType);
|
||||
$oTGHttp->sendToTG($sMessage, $aUpdate);
|
||||
|
||||
Http::response(200, 'error');
|
||||
}
|
||||
|
||||
15
app/Services/TG/Hook/Mod/Tom.php
Normal file
15
app/Services/TG/Hook/Mod/Tom.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\TG\Hook\Mod;
|
||||
//use App\Services\TomTool\Http;
|
||||
//use App\Models\Option as ModelOption;
|
||||
//use App\Models\ArticleList;
|
||||
|
||||
class Tom extends Base {
|
||||
|
||||
public function hello()
|
||||
{
|
||||
return "hello !!";
|
||||
}
|
||||
|
||||
}
|
||||
@ -13,32 +13,50 @@ class Http {
|
||||
$this->sApiChatId = env('telegram_chatid');
|
||||
}
|
||||
|
||||
public function sendToTG($sMsg, $mType = false)
|
||||
public function sendToTG($sMsg, $aUpdate = [])
|
||||
{
|
||||
|
||||
if ($mType == "dove") {
|
||||
if (isset($aUpdate["shell"]) && $aUpdate["shell"] == "cmd") {
|
||||
|
||||
echo $sMsg;
|
||||
|
||||
if (env("is_loc") == true) {
|
||||
echo "<pre>";
|
||||
}
|
||||
} else if (isset($aUpdate["is_dove"]) && $aUpdate["is_dove"] == true) {
|
||||
|
||||
echo $sMsg;
|
||||
|
||||
} else {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
|
||||
file_get_contents($url);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if ($mType == "dove") {
|
||||
//
|
||||
// if (env("is_loc") == true) {
|
||||
// echo "<pre>";
|
||||
// }
|
||||
//
|
||||
// echo $sMsg;
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// if ($mType == "dove") {
|
||||
//
|
||||
// echo $sMsg;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user