diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index 54f079e..ef8466a 100755 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Article; +use App\Models\Option; use App\Services\TG\Http as TGHttp; class CronController @@ -42,6 +43,13 @@ class CronController } } + // 暂停 + $option = Option::where("type", "pause")->first(); + $isPause = $option ? $option->value : null; + if ($isPause == 1) { + exit("暂停"); + } + // i_in10规则 $iIin10 = $i[1]; $aArticle = Article::where("i_in10", $iIin10)->where("status", 1)->get()->toArray(); diff --git a/app/Http/Controllers/TestsController.php b/app/Http/Controllers/TestsController.php index 8ee8db0..8dee685 100755 --- a/app/Http/Controllers/TestsController.php +++ b/app/Http/Controllers/TestsController.php @@ -13,38 +13,38 @@ class TestsController public function hook($sHostName = 'ssssss') { - // 定义要添加的配置 - $host = $sHostName; - $hostname = "github.com"; - $user = "git"; - $identityFile = env("path_ssh")."/id_rsa_".$sHostName; - - // 构建配置字符串 - $config = "\nHost ".$host.".com\n"; - $config .= "\tHostName $hostname\n"; - $config .= "\tUser $user\n"; - $config .= "\tIdentityFile $identityFile\n"; - - // 指定 SSH 配置文件路径 - $sshConfigFile = env("path_ssh")."/config"; - - // 检查文件是否存在,如果不存在则创建 - if (!file_exists($sshConfigFile)) { - touch($sshConfigFile); - } - - // 追加配置到文件 - file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX); - - // 设置文件权限 - chmod($sshConfigFile, 0600); - - echo "SSH config updated successfully."; +// // 定义要添加的配置 +// $host = $sHostName; +// $hostname = "github.com"; +// $user = "git"; +// $identityFile = env("path_ssh")."/id_rsa_".$sHostName; +// +// // 构建配置字符串 +// $config = "\nHost ".$host.".com\n"; +// $config .= "\tHostName $hostname\n"; +// $config .= "\tUser $user\n"; +// $config .= "\tIdentityFile $identityFile\n"; +// +// // 指定 SSH 配置文件路径 +// $sshConfigFile = env("path_ssh")."/config"; +// +// // 检查文件是否存在,如果不存在则创建 +// if (!file_exists($sshConfigFile)) { +// touch($sshConfigFile); +// } +// +// // 追加配置到文件 +// file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX); +// +// // 设置文件权限 +// chmod($sshConfigFile, 0600); +// +// echo "SSH config updated successfully."; - exit; +// exit; // $t = []; // $a = $t['zz']["cc"] += 10; // $a = $t['zz']["cc"] += 10; @@ -62,7 +62,7 @@ class TestsController //test // $s = "\/AticleSet__1115zz__sale_rate 1118.118"; // $s = "\/git#LastTime 1"; - $s= "/test#cron__i 07"; + $s= "/cron#pause 4"; $oHttp = new Http(); $oHttp->sMethod = "post"; diff --git a/app/Models/Option.php b/app/Models/Option.php new file mode 100755 index 0000000..eaa4a72 --- /dev/null +++ b/app/Models/Option.php @@ -0,0 +1,11 @@ +first(); + + // 检查是否找到了选项 + if ($oOption) { + $oOption->value = $v; + + // 保存并返回结果 + return json_encode($oOption->save()); + } + + // 如果没有找到选项,返回一个错误信息 + return json_encode(['error' => 'Option not found']); + } + +}