no message

This commit is contained in:
hellcat 2025-04-18 20:36:04 +08:00
parent e3a201a71f
commit 55fd8be0a9
4 changed files with 75 additions and 29 deletions

View File

@ -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();

View File

@ -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";

11
app/Models/Option.php Executable file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Option extends Model
{
protected $table = 'option';
public $timestamps = false;
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Services\TG\Hook\Mod;
use App\Models\Option as ModelOption;
class Cron extends Base {
public function Pause($aParam)
{
$v = $aParam['aArg'][1];
// 获取第一个匹配的选项
$oOption = ModelOption::where("type", "pause")->first();
// 检查是否找到了选项
if ($oOption) {
$oOption->value = $v;
// 保存并返回结果
return json_encode($oOption->save());
}
// 如果没有找到选项,返回一个错误信息
return json_encode(['error' => 'Option not found']);
}
}