From 3edc6e83d71aff11ae1312feafec878ef9f20e9e Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 3 Sep 2022 18:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index c7dcf7bd..50744b3d 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -171,13 +171,11 @@ export default class CronService { case 'schedule': case 'label': const column = textArray[0] === 'label' ? 'labels' : textArray[0]; - query = { - [column]: { - [Op.or]: [ - { [Op.like]: `%${textArray[1]}%` }, - { [Op.like]: `%${encodeURIComponent(textArray[1])}%` }, - ], - }, + query[column] = { + [Op.or]: [ + { [Op.like]: `%${textArray[1]}%` }, + { [Op.like]: `%${encodeURIComponent(textArray[1])}%` }, + ], }; break; default: @@ -187,22 +185,20 @@ export default class CronService { { [Op.like]: `%${encodeURIComponent(searchText)}%` }, ], }; - query = { - [Op.or]: [ - { - name: reg, - }, - { - command: reg, - }, - { - schedule: reg, - }, - { - labels: reg, - }, - ], - }; + query[Op.or] = [ + { + name: reg, + }, + { + command: reg, + }, + { + schedule: reg, + }, + { + labels: reg, + }, + ]; break; } }