Cron Web应用插件安装教程

sockstack

概述

cronweb 是基于yzh52521/webman-task的webui实现,yzh52521/webman-task是基于 webman 的动态设置定时任务管理

重要的事情说三次

安装请参照安装步骤,安装基础插件。
安装请参照安装步骤,安装基础插件。
安装请参照安装步骤,安装基础插件。

重要提示:windows用户 启动webman 使用 windows.php

安装基础插件

1.使用tp-orm

composer require yzh52521/webman-task

2.使用laravel-orm

composer require yzh52521/webman-task dev-lv

安装依赖

1.crontab

composer require workerman/crontab

2.guzzle

composer require guzzlehttp/guzzle

3.redis

composer require -W illuminate/redis illuminate/events

修改配置config/redis.php

return [
    'default' => [
        'host'     => '127.0.0.1',
        'password' => null,
        'port'     => 6379,
        'database' => 0,
    ]
];

4.依赖注入

composer require psr/container ^1.1.1 php-di/php-di ^6 doctrine/annotations ^1.14

修改配置config/container.php:

$builder = new \DI\ContainerBuilder();
$builder->addDefinitions(config('dependence', []));
$builder->useAutowiring(true);
$builder->useAnnotations(true);
return $builder->build();

安装应用插件Cron Web

插件管理 > Cron Web > 安装

常见问题

Q:数据表不存在
A:配置没有配置正确,修改config/plugin/yzh52521/task/app.php:

return [
    'enable' => true,
    'task'   => [
        'listen'            => '0.0.0.0:2345',
        'async_listen'      => '0.0.0.0:2346',
        'crontab_table'     => 'system_crontab', //任务计划表
        'crontab_table_log' => 'system_crontab_log',//任务计划流水表
        'prefix'            => '修改这里!!!!!!', //表前缀 与 database 设置一致
        'debug'             => true, //控制台输出日志
        'write_log'         => true,// 任务计划日志
        'runInBackground'   => false //命令行任务是否后台运行
    ],
];

Q:stream_socket_client(): Unable to connect to tcp://0.0.0.0:2345 (在其上下文中,该请求的地址无效。)
A:修改配置config/plugin/yzh52521/task/app.php:

return [
    'enable' => true,
    'task'   => [
        'listen'            => '127.0.0.1:2345', // 修改为具体的IP
        'async_listen'      => '127.0.0.1:2346', // 修改为具体的IP
        'crontab_table'     => 'system_crontab', //任务计划表
        'crontab_table_log' => 'system_crontab_log',//任务计划流水表
        'prefix'            => '修改这里!!!!!!', //表前缀 与 database 设置一致
        'debug'             => true, //控制台输出日志
        'write_log'         => true,// 任务计划日志
        'runInBackground'   => false //命令行任务是否后台运行
    ],
];

Q:RedisManager Not Found
A:安装Redis

composer require -W illuminate/redis illuminate/events

Q:Call to undefined method DI\ContainerBuilder::useAnnotations()
A:新版php-di已经移除该方法,请使用useAttributes,或者使用下面适配的方式:

$builder = new \DI\ContainerBuilder();
$builder->addDefinitions(config('dependence', []));
// 判断方法是否存在
if (method_exists(\DI\ContainerBuilder::class, "useAnnotations")) {
    $builder->useAnnotations(true);
}
// 判断方法是否存在
if (method_exists(\DI\ContainerBuilder::class, "useAttributes")) {
    $builder->useAttributes(true);
}

$builder->useAutowiring(true);
return $builder->build();

博客同步更新,传送门

1122 2 1
2个评论

zhoubanxian

菜单不显示出来怎么弄?

  • sockstack 2023-09-22

    等更新版本重新安装,上一个版本打包错了,你可以临时处理一下,在plugin下新建一个cronweb文件夹,把plugin下的api、app、config目录都放到cronweb目录下,执行php webman app-plugin:install cronweb即可,新版本已经提交了,等老大审核通过,后续正常安装也能用

  • zhoubanxian 2023-09-22

    嗯嗯,我现在临时安装了

  • sockstack 2023-09-22

    已经发布新版了,现在可以正常使用了

ekil

参数输入后会被转义

sockstack

250
积分
0
获赞数
0
粉丝数
2023-04-03 加入
🔝