From ac2bbe27bfaff6084ac72e5e90d7a4cba62c527e Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 7 Jul 2025 13:41:03 +0800 Subject: [PATCH] no message --- app/Http/Controllers/TestsController.php | 10 ++++++--- .../TG/Hook/Mod/{Article.php => Dog.php} | 22 ++++++++++++++++++- app/Services/TG/Hook/Mod/Tom.php | 21 ++++++++++++++++++ app/Services/TomTool/Http.php | 4 ++++ just/article_json.json | 2 +- routes/web.php | 2 +- 6 files changed, 55 insertions(+), 6 deletions(-) rename app/Services/TG/Hook/Mod/{Article.php => Dog.php} (89%) create mode 100644 app/Services/TG/Hook/Mod/Tom.php diff --git a/app/Http/Controllers/TestsController.php b/app/Http/Controllers/TestsController.php index 0791a70..559e9f2 100755 --- a/app/Http/Controllers/TestsController.php +++ b/app/Http/Controllers/TestsController.php @@ -58,9 +58,9 @@ class TestsController @$k = $_GET["k"]; @$s = $_GET["s"]; - if ($k !== "wocaonide") { - exit("?"); - } +// if ($k !== "wocaonide") { +// exit("?"); +// } $s = '/'.$s; @@ -69,6 +69,10 @@ class TestsController // $s = "\/git#LastTime 1"; $s= "/test#cron__i 07"; + $s = "/dog#list"; + + $s = "/dog#github 1"; + $oHttp = new Http(); $oHttp->sMethod = "post"; $oHttp->sToUrl = env("APP_URL")."/api/tg/hook"; diff --git a/app/Services/TG/Hook/Mod/Article.php b/app/Services/TG/Hook/Mod/Dog.php similarity index 89% rename from app/Services/TG/Hook/Mod/Article.php rename to app/Services/TG/Hook/Mod/Dog.php index 8dd5eec..d50c523 100644 --- a/app/Services/TG/Hook/Mod/Article.php +++ b/app/Services/TG/Hook/Mod/Dog.php @@ -3,7 +3,27 @@ namespace App\Services\TG\Hook\Mod; use App\Models\Article as ModelArticle; -class Article extends Base { +class Dog extends Base { + + public function Github($aParam) + { + $iId = $aParam["aArg"][1] ?? false; + + if (empty($aParam["aOption"]) && empty($aParam["aArg"])) { + return "/dog#github {id}"; + } + + $oArticle = ModelArticle::find($iId); + +// https://api.github.com/repos/v2rayclashfree-com/v2rayclashfree + $this->oHttp->sToUrl = "https://api.github.com/repos/".$oArticle->user_name."/".$oArticle->project_name; + $this->oHttp->sMetHod = "get"; + $this->oHttp->bIsJson = true; + $r = $this->oHttp->send(); + + + tomd($r); + } public function List($aParam) { diff --git a/app/Services/TG/Hook/Mod/Tom.php b/app/Services/TG/Hook/Mod/Tom.php new file mode 100644 index 0000000..1445e78 --- /dev/null +++ b/app/Services/TG/Hook/Mod/Tom.php @@ -0,0 +1,21 @@ +sToUrl . '?' . http_build_query($this->aData)); // 设置请求 URL + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'User-Agent: JohnDoeDev' // 替换为你的应用名称 + ]); + if ($this->bIsJson) { curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Accept: application/json' // 设置接受的内容类型为 JSON diff --git a/just/article_json.json b/just/article_json.json index e6b48d3..f607beb 100644 --- a/just/article_json.json +++ b/just/article_json.json @@ -1,5 +1,5 @@ { - "id": 1003, + "id": 105, "user_name": "telegram", "project_name": "windows-clash-v2ray", "mail_name": "haoliugen1212", diff --git a/routes/web.php b/routes/web.php index 4ce5af9..63915eb 100755 --- a/routes/web.php +++ b/routes/web.php @@ -11,7 +11,7 @@ Route::get('/cron', [CronController::class, 'index']); Route::get('/test/hello', [TestsController::class, 'hello']); -Route::get('/tests/hook', [TestsController::class, 'hook']); +Route::get('/test/hook', [TestsController::class, 'hook']); //Route::post('/api/tg/hook', [HookController::class, 'cmd']);