From 07632f000555f3ce90acb4adaf76859628543907 Mon Sep 17 00:00:00 2001 From: cddjr Date: Mon, 5 Sep 2022 01:49:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E5=9B=BE=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?`=E4=B8=8D=E5=8C=85=E5=90=AB`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用Op.and确保原文和编码后的内容都不包含才算匹配上 --- back/services/cron.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index fcf11a74..c6ea3e3f 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -121,13 +121,16 @@ export default class CronService { for (const col of viewQuery.filters) { const { property, value, operation } = col; let q: any = {}; + let operate2 = null; let operate = null; switch (operation) { case 'Reg': operate = Op.like; + operate2 = Op.or; break; case 'NotReg': operate = Op.notLike; + operate2 = Op.and; break; case 'In': q[Op.or] = [ @@ -154,9 +157,9 @@ export default class CronService { default: break; } - if (operate) { + if (operate && operate2) { q[property] = { - [Op.or]: [ + [operate2]: [ { [operate]: `%${value}%` }, { [operate]: `%${encodeURIComponent(value)}%` }, ],