承接 yzh52521/webman-task 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yzh52521/webman-task

Composer 安装命令:

composer require yzh52521/webman-task

包简介

dynamic crontab task plugin for webman.

README 文档

README

概述

基于 webman + 的动态秒级定时任务管理,兼容 Windows 和 Linux 系统。

使用tp-orm

composer require yzh52521/webman-task

使用laravel orm

composer require yzh52521/webman-task dev-lv

简单使用

   $param = [
     'method' => 'crontabIndex',//计划任务列表
     'args'   => ['limit' => 10, 'page' => 1]//参数
    ];
   $result= yzh52521\Task\Client::instance()->request($param);
   return json($result);

计划任务列表

方法名

method: crontabIndex

请求参数

args

参数名称 是否必须 示例 备注
page 1 页码
limit 15 每页条数

返回数据

{
"code": 200,
"msg": "ok",
"data": {
"total": 4,
"per_page": 15,
"current_page": 1,
"last_page": 1,
"data": [
{
"id": 6,
"title": "class任务 每月1号清理所有日志",
"type": 2,
"rule": "0 0 1 * *",
"target": "app\\common\\crontab\\ClearLogCrontab",
"parameter": "",
"running_times": 71,
"last_running_time": 1651121710,
"remark": "",
"sort": 0,
"status": 1,
"create_time": 1651114277,
"update_time": 1651114277,
"singleton": 1
},
{
"id": 5,
"title": "eavl任务 输出 hello world",
"type": 4,
"rule": "* * * * *",
"target": "echo 'hello world';",
"parameter": "",
"running_times": 25,
"last_running_time": 1651121701,
"remark": "",
"sort": 0,
"status": 1,
"create_time": 1651113561,
"update_time": 1651113561,
"singleton": 0
},
{
"id": 3,
"title": "url任务 打开 workerman 网站",
"type": 3,
"rule": "*/20 * * * * *",
"target": "https://www.workerman.net/",
"parameter": "",
"running_times": 39,
"last_running_time": 1651121700,
"remark": "请求workerman网站",
"sort": 0,
"status": 1,
"create_time": 1651112925,
"update_time": 1651112925,
"singleton": 0
},
{
"id": 1,
"title": "command任务 输出 webman 版本",
"type": 1,
"rule": "*/20 * * * * *",
"target": "version",
"parameter": null,
"running_times": 112,
"last_running_time": 1651121700,
"remark": "20秒",
"sort": 0,
"status": 1,
"create_time": 1651047480,
"update_time": 1651047480,
"singleton": 1
}
]
}
}

计划任务日志列表

method: crontabLog

请求参数

args

参数名称 是否必须 示例 备注
page 1 页码
limit 15 每页条数
crontab_id 1 计划任务ID

返回数据

{
  "code": 200,
  "msg": "ok",
  "data": {
    "total": 97,
    "per_page": 15,
    "current_page": 1,
    "last_page": 7,
    "data": [
      {
        "id": 257,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "Webman-framework v1.3.11",
        "return_code": 0,
        "running_time": "0.834571",
        "create_time": 1651123800,
        "update_time": 1651123800
      },
      {
        "id": 251,
        "crontab_id": 1,
        "target": "version",
        "parameter": "",
        "exception": "Webman-framework v1.3.11",
        "return_code": 0,
        "running_time": "0.540384",
        "create_time": 1651121700,
        "update_time": 1651121700
      },
      {
        "id": 246,
        "crontab_id": 1,
        "target": "version",
        "parameter": "{}",
        "exception": "Webman-framework v1.3.11",
        "return_code": 0,
        "running_time": "0.316019",
        "create_time": 1651121640,
        "update_time": 1651121640
      },
      {
        "id": 244,
        "crontab_id": 1,
        "target": "version",
        "parameter": "{}",
        "exception": "Webman-framework v1.3.11",
        "return_code": 0,
        "running_time": "0.493848",
        "create_time": 1651121580,
        "update_time": 1651121580
      }
    ]
  }
}

添加任务

method: crontabCreate

请求参数

args

参数名称 参数类型 是否必须 示例 备注
title text 输出 webman 版本 任务标题
type text 1 任务类型 (1 command, 2 class, 3 url, 4 eval ,5 shell)
rule text */3 * * * * * 任务执行表达式
target text version 调用任务字符串
parameter text {} 调用任务参数(url和eval无效)
remark text 每3秒执行 备注
sort text 0 排序
status text 1 状态[0禁用; 1启用]
singleton text 1 是否单次执行 [0 是 1 不是]

返回数据

{
  "code": 200,
  "msg": "ok",
  "data": {
    
  }
}

重启任务

method: crontabReload

请求参数

args

参数名称 参数类型 是否必须 示例 备注
id text 1,2 计划任务ID 多个逗号隔开

返回数据

{
  "code": 200,
  "msg": "ok",
  "data": {
    
  }
}

修改任务

method: crontabUpdate

请求参数

args

参数名称 参数类型 是否必须 示例 备注
id text 1
title text 输出 webman 版本 任务标题
type text 1 任务类型 (1 command, 2 class, 3 url, 4 eval,5 shell)
rule text */3 * * * * * 任务执行表达式
target text version 调用任务字符串
parameter text {} 调用任务参数(url和eval无效)
remark text 每3秒执行 备注
sort text 0 排序
status text 1 状态[0禁用; 1启用]
singleton text 1 是否单次执行 [0 是 1 不是]

返回数据

{
  "code": 200,
  "msg": "ok",
  "data": {
    
  }
}

删除任务

method: crontabDelete

请求参数

args

参数名称 参数类型 是否必须 示例 备注
id text 1,2 计划任务ID 多个逗号隔开

返回数据

{
  "code": 200,
  "msg": "ok",
  "data": {
    
  }
}

支持我

您的认可是我继续前行的动力,如果您觉得webman-task对您有帮助,请支持我,谢谢您!

  • 方式一: 点击右上角⭐Star按钮
  • 方式二: 扫描下方二维码,打赏我
扫码打赏我扫码打赏我

yzh52521/webman-task 适用场景与选型建议

yzh52521/webman-task 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2022 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「task」 「crontab」 「webman」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yzh52521/webman-task 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yzh52521/webman-task 我们能提供哪些服务?
定制开发 / 二次开发

基于 yzh52521/webman-task 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-03