定时任务增加运行任务前和运行任务后参数

This commit is contained in:
whyour
2023-09-19 22:44:32 +08:00
parent 8d899f1a53
commit ab3fc9b5f1
11 changed files with 88 additions and 36 deletions
+7 -1
View File
@@ -19,6 +19,8 @@ export class Crontab {
last_execution_time?: number;
sub_id?: number;
extra_schedules?: Array<{ schedule: string }>;
task_before?: string;
task_after?: string;
constructor(options: Crontab) {
this.name = options.name;
@@ -41,6 +43,8 @@ export class Crontab {
this.last_execution_time = options.last_execution_time || 0;
this.sub_id = options.sub_id;
this.extra_schedules = options.extra_schedules;
this.task_before = options.task_before;
this.task_after = options.task_after;
}
}
@@ -77,5 +81,7 @@ export const CrontabModel = sequelize.define<CronInstance>('Crontab', {
last_running_time: DataTypes.NUMBER,
last_execution_time: DataTypes.NUMBER,
sub_id: { type: DataTypes.NUMBER, allowNull: true },
extra_schedules: DataTypes.JSON
extra_schedules: DataTypes.JSON,
task_before: DataTypes.STRING,
task_after: DataTypes.STRING,
});