diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index 07bd9ac..54ce7b1 100755 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -175,12 +175,12 @@ class CronController return $str; } - private function runCommand($command) { + private function runCommand($command, $show_error = 1) { $output = []; $returnVar = 0; exec($command, $output, $returnVar); - if ($returnVar !== 0 && $this->aArticle['show_error'] == 1) { + if ($returnVar !== 0 && $this->aArticle['show_error'] == 1 && $show_error == 1) { $aMsg = [ "命令" => $command, @@ -217,8 +217,8 @@ class CronController $this->runCommand("git remote add origin \"{$this->sProjectUrl}\""); // 立即拉取覆盖一次 - $this->runCommand("git fetch origin"); - // $this->runCommand("git reset --hard origin/main"); + $this->runCommand("git fetch origin", 0); + $this->runCommand("git reset --hard origin/main", 0); echo "操作完成:以初始化仓库[".$this->aArticle['id']."]。\n";