From 4194e9e12f13a74eb2e60d36230a108b4fd14085 Mon Sep 17 00:00:00 2001 From: Miyamizu-MitsuhaSang <2510681107@qq.com> Date: Thu, 6 Nov 2025 20:02:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=AC=A1=E6=95=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/sqldialects.xml | 10 ---------- app/api/search_dict/service.py | 2 +- app/api/util_api/routes.py | 6 +++--- main.py | 4 ++-- 4 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 .idea/sqldialects.xml diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml deleted file mode 100644 index cae4fd3..0000000 --- a/.idea/sqldialects.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/api/search_dict/service.py b/app/api/search_dict/service.py index c76056d..6cd7f9e 100644 --- a/app/api/search_dict/service.py +++ b/app/api/search_dict/service.py @@ -14,7 +14,7 @@ from settings import TORTOISE_ORM async def search_time_updates(redis: Redis) -> None: - key = "search_times" + key = "search_time" await redis.incr(key, 1) diff --git a/app/api/util_api/routes.py b/app/api/util_api/routes.py index 93974b0..c7a6b09 100644 --- a/app/api/util_api/routes.py +++ b/app/api/util_api/routes.py @@ -10,11 +10,11 @@ async def get_search_time(request: Request): key = f"search_time" - count = int(await redis.get(key)) + count = await redis.get(key) if not count: await redis.set(key, value=0) count = 0 - print(count) + print(count, type(count)) return { - "count": count, + "count": int(count), } diff --git a/main.py b/main.py index 8aca619..c1c493f 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ from app.api.util_api.routes import ulit_router from app.api.word_comment.routes import word_comment_router from app.core.redis import init_redis, close_redis from app.utils.phone_encrypt import PhoneEncrypt -from settings import ONLINE_SETTINGS +from settings import TORTOISE_ORM @asynccontextmanager @@ -47,7 +47,7 @@ app.add_middleware( register_tortoise( app=app, - config=ONLINE_SETTINGS, + config=TORTOISE_ORM ) app.include_router(users_router, tags=["User API"], prefix="/users")