mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat(timer): 新增多节点定时器协调的 Scheme 定义
This commit is contained in:
@@ -27,6 +27,10 @@ class SystemHost extends BaseScheme
|
||||
#[Component(type: 'switch', options: ['离线', '在线'])]
|
||||
public $status;
|
||||
|
||||
#[Field(type: 'tinyint', length: 4, default: '0', comment: '是否主节点:0=否,1=是')]
|
||||
#[Component(type: 'switch', options: ['否', '是'])]
|
||||
public $is_master;
|
||||
|
||||
#[Field(type: 'datetime', comment: '最后心跳时间')]
|
||||
#[Component(type: 'date', options: [])]
|
||||
public $last_heartbeat_at;
|
||||
|
||||
53
app/admin/scheme/SystemTimerConfig.php
Normal file
53
app/admin/scheme/SystemTimerConfig.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\scheme;
|
||||
|
||||
use app\common\scheme\BaseScheme;
|
||||
use app\common\scheme\attribute\Table;
|
||||
use app\common\scheme\attribute\Field;
|
||||
use app\common\scheme\attribute\Component;
|
||||
use app\common\scheme\attribute\Index;
|
||||
|
||||
#[Table(name: 'ul_system_timer_config', comment: '定时任务协调配置表')]
|
||||
#[Index(columns: ['task_name'], name: 'task_name', type: 'UNIQUE')]
|
||||
class SystemTimerConfig extends BaseScheme
|
||||
{
|
||||
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
|
||||
public $id;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, nullable: false, comment: '任务名称')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $task_name;
|
||||
|
||||
#[Field(type: 'varchar', length: 20, default: 'auto', comment: '运行类型:main/auto/all/manual')]
|
||||
#[Component(type: 'select', options: ['main' => 'main', 'auto' => 'auto', 'all' => 'all', 'manual' => 'manual'])]
|
||||
public $run_type;
|
||||
|
||||
#[Field(type: 'tinyint', length: 4, default: '1', comment: '状态:0=停用,1=启用')]
|
||||
#[Component(type: 'switch', options: ['停用', '启用'])]
|
||||
public $status;
|
||||
|
||||
#[Field(type: 'tinyint', length: 4, default: '0', comment: '是否已同步:0=未同步,1=已同步')]
|
||||
#[Component(type: 'switch', options: ['未同步', '已同步'])]
|
||||
public $is_synced;
|
||||
|
||||
#[Field(type: 'varchar', length: 100, nullable: true, comment: '最后执行节点ID')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $last_execute_node;
|
||||
|
||||
#[Field(type: 'int', length: 11, default: '0', comment: '最后执行时间戳', unsigned: true)]
|
||||
#[Component(type: 'date', options: [])]
|
||||
public $last_execute_time;
|
||||
|
||||
#[Field(type: 'tinyint', length: 4, default: '0', comment: '手动触发标记:0=未触发,1=已触发')]
|
||||
#[Component(type: 'switch', options: ['未触发', '已触发'])]
|
||||
public $manual_trigger;
|
||||
|
||||
#[Field(type: 'int', length: 11, comment: '创建时间', unsigned: true)]
|
||||
#[Component(type: 'date', options: [])]
|
||||
public $create_time;
|
||||
|
||||
#[Field(type: 'int', length: 11, comment: '更新时间', unsigned: true)]
|
||||
#[Component(type: 'date', options: [])]
|
||||
public $update_time;
|
||||
}
|
||||
60
app/admin/scheme/SystemTimerLog.php
Normal file
60
app/admin/scheme/SystemTimerLog.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\scheme;
|
||||
|
||||
use app\common\scheme\BaseScheme;
|
||||
use app\common\scheme\attribute\Table;
|
||||
use app\common\scheme\attribute\Field;
|
||||
use app\common\scheme\attribute\Component;
|
||||
use app\common\scheme\attribute\Index;
|
||||
|
||||
#[Table(name: 'ul_system_timer_log', comment: '定时器执行日志表')]
|
||||
#[Index(columns: ['task_name'], name: 'idx_task_name', type: 'NORMAL')]
|
||||
#[Index(columns: ['node_id'], name: 'idx_node_id', type: 'NORMAL')]
|
||||
#[Index(columns: ['start_time'], name: 'idx_start_time', type: 'NORMAL')]
|
||||
#[Index(columns: ['status'], name: 'idx_status', type: 'NORMAL')]
|
||||
class SystemTimerLog extends BaseScheme
|
||||
{
|
||||
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
|
||||
public $id;
|
||||
|
||||
#[Field(length: 100, precision: 100, nullable: false, comment: '任务名称')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $task_name;
|
||||
|
||||
#[Field(length: 100, precision: 100, nullable: false, comment: '执行节点ID')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $node_id;
|
||||
|
||||
#[Field(length: 20, precision: 20, comment: '运行类型')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $run_type;
|
||||
|
||||
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, comment: '开始时间戳')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $start_time;
|
||||
|
||||
#[Field(type: 'int', length: 11, unsigned: true, default: '0', comment: '结束时间戳')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $end_time;
|
||||
|
||||
#[Field(type: 'int', length: 11, unsigned: true, default: '0', comment: '耗时(毫秒)')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $duration;
|
||||
|
||||
#[Field(length: 20, precision: 20, default: 'running', comment: '状态:running/success/error')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $status;
|
||||
|
||||
#[Field(type: 'text', nullable: true, comment: '错误信息')]
|
||||
#[Component(type: 'textarea', options: [])]
|
||||
public $error_message;
|
||||
|
||||
#[Field(type: 'int', length: 11, default: '0', comment: '并发分片ID')]
|
||||
#[Component(type: 'text', options: [])]
|
||||
public $concurrency_id;
|
||||
|
||||
#[Field(type: 'int', length: 11, unsigned: true, comment: '创建时间')]
|
||||
#[Component(type: 'date', options: [])]
|
||||
public $create_time;
|
||||
}
|
||||
Reference in New Issue
Block a user