diff --git a/app/Console/Tasks/CleanLogTask.php b/app/Console/Tasks/CleanLogTask.php index 2a874bf6..c5d62424 100644 --- a/app/Console/Tasks/CleanLogTask.php +++ b/app/Console/Tasks/CleanLogTask.php @@ -19,7 +19,6 @@ class CleanLogTask extends Task $this->cleanHttpLog(); $this->cleanSqlLog(); $this->cleanListenLog(); - $this->cleanCaptchaLog(); $this->cleanWeChatLog(); $this->cleanMailLog(); $this->cleanSmsLog(); @@ -96,18 +95,6 @@ class CleanLogTask extends Task $this->whitelist[] = $type; } - /** - * 清理验证码服务日志 - */ - protected function cleanCaptchaLog() - { - $type = 'captcha'; - - $this->cleanLog($type, 7); - - $this->whitelist[] = $type; - } - /** * 清理点播服务日志 */ @@ -268,13 +255,12 @@ class CleanLogTask extends Task * 清理其它日志 * * @param int $keepDays - * @return mixed */ protected function cleanOtherLog($keepDays = 7) { $files = glob(log_path() . "/*.log"); - if (!$files) return false; + if (!$files) return; foreach ($files as $file) { $name = str_replace(log_path() . '/', '', $file); @@ -287,9 +273,9 @@ class CleanLogTask extends Task if (strtotime($today) - strtotime($date) >= $keepDays * 86400) { $deleted = unlink($file); if ($deleted) { - echo "delete {$file} success" . PHP_EOL; + $this->successPrint("remove {$file} success"); } else { - echo "delete {$file} failed" . PHP_EOL; + $this->errorPrint("remove {$file} failed"); } } } @@ -300,13 +286,12 @@ class CleanLogTask extends Task * * @param string $prefix * @param int $keepDays 保留天数 - * @return mixed */ protected function cleanLog($prefix, $keepDays) { $files = glob(log_path() . "/{$prefix}-*.log"); - if (!$files) return false; + if (!$files) return; foreach ($files as $file) { $date = substr($file, -14, 10); @@ -314,9 +299,9 @@ class CleanLogTask extends Task if (strtotime($today) - strtotime($date) >= $keepDays * 86400) { $deleted = unlink($file); if ($deleted) { - echo "------ delete {$file} success ------" . PHP_EOL; + $this->successPrint("remove {$file} success"); } else { - echo "------ delete {$file} failed -------" . PHP_EOL; + $this->errorPrint("remove {$file} failed"); } } } diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php index a4cf06fd..59a9b853 100644 --- a/app/Console/Tasks/Task.php +++ b/app/Console/Tasks/Task.php @@ -11,5 +11,17 @@ use App\Traits\Service as ServiceTrait; class Task extends \Phalcon\Cli\Task { + use ServiceTrait; + + protected function successPrint($text) + { + echo "\033[32m {$text} \033[0m" . PHP_EOL; + } + + protected function errorPrint($text) + { + echo "\033[31m {$text} \033[0m" . PHP_EOL; + } + } diff --git a/app/Http/Api/Controllers/PublicController.php b/app/Http/Api/Controllers/PublicController.php index c350a69c..05158ea4 100644 --- a/app/Http/Api/Controllers/PublicController.php +++ b/app/Http/Api/Controllers/PublicController.php @@ -76,20 +76,6 @@ class PublicController extends Controller return $this->jsonSuccess(['site' => $site]); } - /** - * @Get("/captcha/info", name="api.public.captcha_info") - */ - public function captchaInfoAction() - { - $service = new AppService(); - - $captcha = $service->getSettings('captcha'); - - unset($captcha['secret_key']); - - return $this->jsonSuccess(['captcha' => $captcha]); - } - /** * @Get("/payment/info", name="api.public.payment_info") */