From f55ce265d80b2046b52d83df53f2ece5fe407559 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Wed, 16 Apr 2025 18:48:43 +0800 Subject: [PATCH] no message --- app/Http/Controllers/CronController.php | 5 +++- app/Http/Controllers/TestsController.php | 4 +-- app/Services/Github/Mod/Base.php | 26 ++++++++++++++++++ app/Services/Github/Mod/FreeNode.php | 34 ++++++++++++++++++------ 4 files changed, 58 insertions(+), 11 deletions(-) create mode 100755 app/Services/Github/Mod/Base.php diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index b4854ba..1b391e4 100755 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -116,7 +116,10 @@ class CronController } // 写入内容 - file_put_contents($this->sProjectPath."/README.md", $this->formatstr($sReadMe)); + if ($sReadMe) { + file_put_contents($this->sProjectPath."/README.md", $this->formatstr($sReadMe)); + } + file_put_contents($this->sProjectPath."/version.text", time()); // 提交 diff --git a/app/Http/Controllers/TestsController.php b/app/Http/Controllers/TestsController.php index 65374bf..199df4e 100755 --- a/app/Http/Controllers/TestsController.php +++ b/app/Http/Controllers/TestsController.php @@ -28,8 +28,8 @@ class TestsController //test // $s = "\/AticleSet__1115zz__sale_rate 1118.118"; - $s = "\/git#LastTime 1"; -// $s= "/test#cron__i 07"; +// $s = "\/git#LastTime 1"; + $s= "/test#cron__i 07"; $oHttp = new Http(); $oHttp->sMethod = "post"; diff --git a/app/Services/Github/Mod/Base.php b/app/Services/Github/Mod/Base.php new file mode 100755 index 0000000..3cf8fdf --- /dev/null +++ b/app/Services/Github/Mod/Base.php @@ -0,0 +1,26 @@ +oHttp = new Http(); + } + + public function todayUpd() + { + + $this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/todayupd'; + $r = $this->oHttp->send(); + + if ($r == 1) { + return true; + } else { + return false; + } + + } + +} diff --git a/app/Services/Github/Mod/FreeNode.php b/app/Services/Github/Mod/FreeNode.php index 60af717..3465830 100755 --- a/app/Services/Github/Mod/FreeNode.php +++ b/app/Services/Github/Mod/FreeNode.php @@ -2,7 +2,7 @@ namespace App\Services\Github\Mod; use App\Services\TomTool\Http; -class FreeNode { +class FreeNode extends Base { public $sTitle; // 必须 public $sContent; // 必须 @@ -11,9 +11,12 @@ class FreeNode { public function A($aArticle) { - $oHttp = new Http(); - $oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast'; - $sFreenodeNow = $oHttp->send(); + if (!$this->todayUpd()) { + return false; + } + + $this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast'; + $sFreenodeNow = $this->oHttp->send(); $aFreenodeNow = json_decode($sFreenodeNow, 1); $sTitleSub = $aFreenodeNow['title_sub']; @@ -59,9 +62,12 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml public function B($aArticle) { - $oHttp = new Http(); - $oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast'; - $sFreenodeNow = $oHttp->send(); + if (!$this->todayUpd()) { + return false; + } + + $this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast'; + $sFreenodeNow = $this->oHttp->send(); $aFreenodeNow = json_decode($sFreenodeNow, 1); $sTitleSub = $aFreenodeNow['title_sub']; @@ -103,6 +109,10 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml public function C($aArticle) { + if (!$this->todayUpd()) { + return false; + } + $sContent = " # 公益免费v2ray节点订阅,每小时更新,最后更新时间:".date('Y-m-d H:i:s')." @@ -146,7 +156,15 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml public function Test($aArticle) { - return "test!!!"; + if (!$this->todayUpd()) { + return false; + } + + $this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast'; + $sFreenodeNow = $this->oHttp->send(); + $aFreenodeNow = json_decode($sFreenodeNow, 1); + + return json_encode($aFreenodeNow).time(); } }