From 4526c84330a624b3955c0371e09fb8da7e76f44c Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 10 Dec 2022 19:00:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=A7=86=E5=9B=BE=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=A0=87=E7=AD=BE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 23 ++++++++++++++++++----- src/pages/crontab/viewCreateModal.tsx | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index 105ce646..1940951e 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -12,8 +12,7 @@ import { killTask, } from '../config/util'; import { promises, existsSync } from 'fs'; -import { promisify } from 'util'; -import { Op } from 'sequelize'; +import { Op, where, col as colFn } from 'sequelize'; import path from 'path'; @Service() @@ -164,9 +163,23 @@ export default class CronService { } if (operate && operate2) { q[property] = { - [operate2]: [ - { [operate]: `%${value}%` }, - { [operate]: `%${encodeURIComponent(value)}%` }, + [Op.or]: [ + { + [operate2]: [ + { [operate]: `%${value}%` }, + { [operate]: `%${encodeURIComponent(value)}%` }, + ], + }, + { + [operate2]: [ + where(colFn(property), operate, `%${value}%`), + where( + colFn(property), + operate, + `%${encodeURIComponent(value)}%`, + ), + ], + }, ], }; } diff --git a/src/pages/crontab/viewCreateModal.tsx b/src/pages/crontab/viewCreateModal.tsx index 5634f492..c07be70d 100644 --- a/src/pages/crontab/viewCreateModal.tsx +++ b/src/pages/crontab/viewCreateModal.tsx @@ -20,7 +20,7 @@ const PROPERTIES = [ { name: '名称', value: 'name' }, { name: '定时规则', value: 'schedule' }, { name: '状态', value: 'status' }, - // { name: '标签', value: 'labels' }, + { name: '标签', value: 'labels' }, ]; const EOperation: any = {