From 9455ca64a29a9a1ee7b63aa1420f4817bd0b728b Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Fri, 8 Oct 2021 23:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A3=80=E6=9F=A5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=92=8C=E5=88=A0=E9=99=A4=E6=97=A5=E5=BF=97=E9=A2=91?= =?UTF-8?q?=E7=8E=87=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 36 ------------------------------------ src/pages/setting/index.tsx | 6 ++++++ 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index 68a71b79..382bf915 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -4,24 +4,6 @@ import { Crontab, CrontabStatus } from '../data/cron'; import CronService from '../services/cron'; import EnvService from '../services/env'; -const initData = [ - { - name: '更新面板', - command: `ql update`, - schedule: `${randomSchedule(60, 1)} ${randomSchedule( - 6, - 1, - ).toString()} * * *`, - isDisabled: 1, - }, - { - name: '删除日志', - command: 'ql rmlog 7', - schedule: '30 7 */7 * *', - isDisabled: 1, - }, -]; - export default async () => { const cronService = Container.get(CronService); const envService = Container.get(EnvService); @@ -32,24 +14,6 @@ export default async () => { cronDb.persistence.compactDatafile(); envDb.persistence.compactDatafile(); - cronDb.count({}, async (err, count) => { - if (count === 0) { - const data = initData.map((x: any) => { - const tab = new Crontab(x); - tab.created = new Date().valueOf(); - tab.saved = false; - if (tab.name === '更新面板') { - tab.isSystem = 1; - } else { - tab.isSystem = 0; - } - return tab; - }); - cronDb.insert(data); - await cronService.autosave_crontab(); - } - }); - // 初始化更新所有任务状态为空闲 cronDb.update( { status: { $in: [CrontabStatus.running, CrontabStatus.queued] } }, diff --git a/src/pages/setting/index.tsx b/src/pages/setting/index.tsx index fc77bd66..69902714 100644 --- a/src/pages/setting/index.tsx +++ b/src/pages/setting/index.tsx @@ -328,6 +328,12 @@ const Setting = ({ buttonStyle="solid" /> + + + + + +