From a3db6713281ebdef06b1bacbade2b547ff6ae547 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Fri, 25 Sep 2020 07:30:49 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E6=9B=B4=E6=96=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=9B=91=E6=8E=A7=E9=85=8D=E7=BD=AE=E8=87=B3=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/monitor/MonitorService.php | 12 +++++++ catch/monitor/config.php | 59 ++++++++++++++++++++++++++++++++ config/catch.php | 48 -------------------------- 3 files changed, 71 insertions(+), 48 deletions(-) create mode 100644 catch/monitor/config.php diff --git a/catch/monitor/MonitorService.php b/catch/monitor/MonitorService.php index 7839860..1ce62d5 100644 --- a/catch/monitor/MonitorService.php +++ b/catch/monitor/MonitorService.php @@ -15,6 +15,18 @@ use catcher\ModuleService; class MonitorService extends ModuleService { + public function register() + { + parent::register(); // TODO: Change the autogenerated stub + + $this->registerConfig(); + } + + protected function registerConfig() + { + $this->app->config->set(array_merge($this->app->config->get('catch'), + require __DIR__ . DIRECTORY_SEPARATOR . 'config.php'), 'catch'); + } public function loadRouteFrom() { // TODO: Implement loadRouteFrom() method. diff --git a/catch/monitor/config.php b/catch/monitor/config.php new file mode 100644 index 0000000..88a5e42 --- /dev/null +++ b/catch/monitor/config.php @@ -0,0 +1,59 @@ + [ + /** + * 存储目录 + */ + 'store_path' => runtime_path('catch/crontab'), + + /** + * 主进程 pid 存储 + */ + 'master_pid_file' => runtime_path('catch/crontab') . 'master.pid', + + /** + * 日志配置 + */ + 'log' => [ + // 日志记录方式 + 'type' => 'File', + // 日志保存目录 + 'path' => runtime_path('catch/schedule'), + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, + // 使用JSON格式记录 + 'json' => false, + // 日志处理 + 'processor' => null, + // 关闭通道日志写入 + 'close' => false, + // 日志输出格式化 + 'format' => '[%s][%s] %s', + // 是否实时写入 + 'realtime_write' => false, + ], + + /** + * crontab 任务命名空间 + */ + 'task_namespace' => '\\app\\task\\', + ], +]; \ No newline at end of file diff --git a/config/catch.php b/config/catch.php index 4f12aed..42fdf77 100644 --- a/config/catch.php +++ b/config/catch.php @@ -76,52 +76,4 @@ return [ 'image' => 'fileSize:' . 1024 * 1024 * 5 . '|fileExt:jpg,png,gif,jpeg', 'file' => 'fileSize:' . 1024 * 1024 * 10 . '|fileExt:txt,pdf,xlsx,xls,html,mp4,mp3,amr' ], - - /** - * - * 定时任务配置 - * - */ - 'crontab' => [ - /** - * 存储目录 - */ - 'store_path' => runtime_path('catch/crontab'), - - /** - * 主进程 pid 存储 - */ - 'master_pid_file' => runtime_path('catch/crontab') . 'master.pid', - - /** - * 日志配置 - */ - 'log' => [ - // 日志记录方式 - 'type' => 'File', - // 日志保存目录 - 'path' => runtime_path('catch/schedule'), - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 使用JSON格式记录 - 'json' => false, - // 日志处理 - 'processor' => null, - // 关闭通道日志写入 - 'close' => false, - // 日志输出格式化 - 'format' => '[%s][%s] %s', - // 是否实时写入 - 'realtime_write' => false, - ], - - /** - * crontab 任务命名空间 - */ - 'task_namespace' => '', - ], ];