diff --git a/catch/monitor/database/seeds/MonitorMenusSeed.php b/catch/monitor/database/seeds/MonitorMenusSeed.php new file mode 100644 index 0000000..229ab58 --- /dev/null +++ b/catch/monitor/database/seeds/MonitorMenusSeed.php @@ -0,0 +1,253 @@ +getPermissions(), 'permissions', 'parent_id'); + } + + protected function getPermissions() + { + return array ( + 0 => + array ( + 'id' => 103, + 'permission_name' => '系统监控', + 'parent_id' => 0, + 'level' => '', + 'route' => '/monitor', + 'icon' => 'el-icon-view', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'monitor', + 'component' => 'layout', + 'redirect' => '/monitor/crontab', + 'keepalive' => 1, + 'type' => 1, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600126383, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + 'children' => + array ( + 0 => + array ( + 'id' => 104, + 'permission_name' => '定时任务', + 'parent_id' => 103, + 'level' => '103', + 'route' => '/monitor/crontab', + 'icon' => 'el-icon-time', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab', + 'component' => 'crontab', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 1, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600126931, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + 'children' => + array ( + 0 => + array ( + 'id' => 105, + 'permission_name' => '列表', + 'parent_id' => 104, + 'level' => '103-104', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab@index', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600127069, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + ), + 1 => + array ( + 'id' => 106, + 'permission_name' => '保存', + 'parent_id' => 104, + 'level' => '103-104', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab@save', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600127078, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + ), + 2 => + array ( + 'id' => 107, + 'permission_name' => '更新', + 'parent_id' => 104, + 'level' => '103-104', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab@update', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600127085, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + ), + 3 => + array ( + 'id' => 108, + 'permission_name' => '删除', + 'parent_id' => 104, + 'level' => '103-104', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab@delete', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600127091, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + ), + 4 => + array ( + 'id' => 109, + 'permission_name' => '禁用/启用', + 'parent_id' => 104, + 'level' => '103-104', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'crontab@disOrEnable', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600129279, + 'updated_at' => 1600136975, + 'deleted_at' => 0, + ), + ), + ), + 1 => + array ( + 'id' => 110, + 'permission_name' => '任务日志', + 'parent_id' => 103, + 'level' => '103-104', + 'route' => '/monitor/crontab/log/:crontab_id?', + 'icon' => 'el-icon-guide', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'CrontabLog', + 'component' => 'crontabLog', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 1, + 'hidden' => 2, + 'sort' => 1, + 'created_at' => 1600167562, + 'updated_at' => 1600188651, + 'deleted_at' => 0, + 'children' => + array ( + 0 => + array ( + 'id' => 111, + 'permission_name' => '列表', + 'parent_id' => 110, + 'level' => '103-104-110', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'CrontabLog@index', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600167574, + 'updated_at' => 1600168082, + 'deleted_at' => 0, + ), + 1 => + array ( + 'id' => 112, + 'permission_name' => '删除', + 'parent_id' => 110, + 'level' => '103-104-110', + 'route' => '', + 'icon' => '', + 'module' => 'monitor', + 'creator_id' => 1, + 'permission_mark' => 'CrontabLog@delete', + 'component' => '', + 'redirect' => '', + 'keepalive' => 1, + 'type' => 2, + 'hidden' => 1, + 'sort' => 1, + 'created_at' => 1600167581, + 'updated_at' => 1600168082, + 'deleted_at' => 0, + ), + ), + ), + ), + ), +); + } +} diff --git a/config/catch.php b/config/catch.php index 21935c5..4f12aed 100644 --- a/config/catch.php +++ b/config/catch.php @@ -78,31 +78,23 @@ return [ ], /** - * 任务调度配置 + * + * 定时任务配置 + * */ - 'schedule' => [ + 'crontab' => [ /** - * 常驻 worker 数量 + * 存储目录 */ - 'static_worker_number' => 4, + 'store_path' => runtime_path('catch/crontab'), /** - * 动态可扩展 worker 最大数量 + * 主进程 pid 存储 */ - 'max_worker_number' => 10, + 'master_pid_file' => runtime_path('catch/crontab') . 'master.pid', /** - * 存储位置 - */ - 'store_path' => runtime_path('catch/schedule'), - - /** - * 主进程 ID - */ - 'master_pid_file' => runtime_path('catch/schedule') . 'master.pid', - - /** - * 日志记录 + * 日志配置 */ 'log' => [ // 日志记录方式 @@ -127,6 +119,9 @@ return [ 'realtime_write' => false, ], - 'schedule_kernel' => \catcher\library\ScheduleKernel::class, + /** + * crontab 任务命名空间 + */ + 'task_namespace' => '', ], ]; diff --git a/extend/catcher/command/TestCommand.php b/extend/catcher/command/TestCommand.php deleted file mode 100644 index ef90e0a..0000000 --- a/extend/catcher/command/TestCommand.php +++ /dev/null @@ -1,10 +0,0 @@ -schedule = new Schedule(); - } - - protected function run() - { - $this->schedule->command('catch:cache')->everyThirtySeconds(); - $this->schedule->command('test')->everyTenSeconds(); - - } - - - public function tasks() - { - $this->run(); - - return $this->schedule->getCronTask(); - } -} \ No newline at end of file