From cb50d4cc8a064b7ce32c4de0e70df0acb5249126 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 21 Apr 2025 18:35:31 +0800 Subject: [PATCH] no message --- public/tests/hook.php | 5 +++++ src/Services/Tg/Hook/Mod/Tk.php | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/public/tests/hook.php b/public/tests/hook.php index 01b022af..9e3da6ef 100644 --- a/public/tests/hook.php +++ b/public/tests/hook.php @@ -65,9 +65,14 @@ $oHttp->aData['message']['text'] = '\/user#find 1'; $oHttp->aData['message']['text'] = '\/cmd#list'; $oHttp->aData['message']['text'] = '\/visitor#all'; +$oHttp->aData['message']['text'] = '\/node#setRateAll 3.12'; //$oHttp->aData['message']['text'] = '\/user#report__day'; //$oHttp->aData['message']['text'] = '\/user#countReg__date__2021-03-28__2028-03-28'; +$oHttp->aData['message']['text'] = '\/tk#ry__1 aasd'; + +$oHttp->aData['message']['text'] = '\/tk#list'; + //{ // "update_id": 761180998, // "message": { diff --git a/src/Services/Tg/Hook/Mod/Tk.php b/src/Services/Tg/Hook/Mod/Tk.php index c79bf08b..8382cf1f 100644 --- a/src/Services/Tg/Hook/Mod/Tk.php +++ b/src/Services/Tg/Hook/Mod/Tk.php @@ -8,7 +8,7 @@ use App\Models\Ticket; //use App\Services\DB; use App\Services\TomTool\Http; -final class Tk +final class Tk extends Base { public function Find($aParam) @@ -63,6 +63,33 @@ final class Tk // // } + public function List($aParam) + { + + $iLimit = @$aParam['aArg'][0]; + + if (!$iLimit) { + $iLimit = 10; //默认10条 + } + + $aTk = Ticket::where("status", "open_wait_admin")->orderBy("id", "desc")->limit($iLimit)->get()->toArray(); + + foreach ($aTk as $row) { + unset($row['datetime']); + unset($row['status']); + unset($row['type']); + $row['content_'] = json_decode($row['content']); + unset($row['content']); + + $sMsg = json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + + $this->oTGHttp->sendToTG($sMsg); + } + + $this->oHttp::response(200, 'ok'); + + } + public function Ry($aParam) { @@ -88,8 +115,12 @@ final class Tk // 不论失败成功都清除 step // $oTgStep->clearByFromId($aUpdate["message"]["from"]["id"]); +// $sPre = "----工单-----------------"; + if ($r["ret"] == 1) { - $sMessage = "成功"; + $aTk = Ticket::find($iTicketId)->toArray(); + $tmp = json_decode($aTk['content']); + $sMessage = json_encode($tmp, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } else { $sMessage = "失败"; }