将配置替换加入单次定时任务,提高启动速度

This commit is contained in:
HibiKier
2022-08-21 18:09:31 +08:00
parent 708e912069
commit 5c695899a1
8 changed files with 132 additions and 116 deletions
+4 -4
View File
@@ -238,14 +238,14 @@ class WordBank(db.Model):
return query.where(cls.problem == problem)
# 正则匹配
if await db.first(
db.text(sql_text + f" and word_type = 2 and '{problem}' ~ problem;")
db.text(sql_text + f" and word_type = 2 and word_scope != 999 and '{problem}' ~ problem;")
):
return sql_text + f" and word_type = 2 and '{problem}' ~ problem;"
return sql_text + f" and word_type = 2 and word_scope != 999 and '{problem}' ~ problem;"
# 模糊匹配
if await db.first(
db.text(sql_text + f" and word_type = 1 and '{problem}' ~ problem;")
db.text(sql_text + f" and word_type = 1 and word_scope != 999 and '{problem}' ~ problem;")
):
return sql_text + f" and word_type = 1 and '{problem}' ~ problem;"
return sql_text + f" and word_type = 1 and word_scope != 999 and '{problem}' ~ problem;"
return None
@classmethod