From 31d4d29f3e622b295e30b64e6a9690eaed8cbed9 Mon Sep 17 00:00:00 2001 From: LambdaYH Date: Sun, 21 Aug 2022 23:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8C=B9=E9=85=8D=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=BF=BD=E8=A7=86=E4=BA=86word=5Ftype=E7=9A=84?= =?UTF-8?q?=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/word_bank/_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/word_bank/_model.py b/plugins/word_bank/_model.py index 42479b75..3759cd58 100644 --- a/plugins/word_bank/_model.py +++ b/plugins/word_bank/_model.py @@ -234,10 +234,10 @@ class WordBank(db.Model): query = query.where(cls.word_scope == word_type) sql_text += f" and word_scope = {word_scope}" # 完全匹配 - if await query.where(cls.problem == problem).gino.first(): + if await query.where(((cls.word_type == 0) | (cls.word_type == 3)) & (cls.problem == problem)).gino.first(): return query.where(cls.problem == problem) # 模糊匹配 - if await query.where(cls.problem.contains(problem)).gino.first(): + if await query.where((cls.word_type == 1) & (cls.problem.contains(problem))).gino.first(): return query.where(cls.problem.contains(problem)) # 正则匹配 if await db.first(