From e48bdf03da32114c9ecaad1c9573caba646a190e Mon Sep 17 00:00:00 2001
From: Art_Sakura <1754798088@qq.com>
Date: Sun, 29 Jun 2025 22:38:51 +0800
Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20=E4=BF=AE=E5=A4=8D=E5=9C=9F?=
=?UTF-8?q?=E5=9C=B0=E7=AD=89=E7=BA=A7=E7=BB=98=E5=88=B6=E5=87=BA=E9=94=99?=
=?UTF-8?q?=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 3 +++
database/user.py | 4 ++--
database/userSoil.py | 4 ++--
farm/farm.py | 14 ++++++++++----
request.py | 3 +--
5 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 57f25c7..e2ea91c 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,9 @@
+
+
+
diff --git a/database/user.py b/database/user.py
index dd01c87..4fe29da 100644
--- a/database/user.py
+++ b/database/user.py
@@ -35,7 +35,7 @@ class CUserDB(CSqlManager):
point (int): 农场币
Returns:
- Union[bool, str]: False 表示失败,字符串表示成功信息
+ bool | str: False 表示失败,字符串表示成功信息
"""
nowStr = g_pToolManager.dateTime().date().today().strftime("%Y-%m-%d")
sql = (
@@ -55,7 +55,7 @@ class CUserDB(CSqlManager):
"""获取所有用户UID列表
Returns:
- List[str]: 用户UID列表
+ list[str]: 用户UID列表
"""
cursor = await cls.m_pDB.execute("SELECT uid FROM user")
rows = await cursor.fetchall()
diff --git a/database/userSoil.py b/database/userSoil.py
index 87a315e..cd0e7c5 100644
--- a/database/userSoil.py
+++ b/database/userSoil.py
@@ -244,7 +244,7 @@ class CUserSoilDB(CSqlManager):
soilIndex (int): 土地索引
Returns:
- Optional[dict]: 记录存在返回字段-值字典,否则返回 None
+ dict: 记录存在返回字段-值字典,否则返回 None
"""
async with cls._transaction():
cursor = await cls.m_pDB.execute(
@@ -266,7 +266,7 @@ class CUserSoilDB(CSqlManager):
soilIndex (int): 土地索引
Returns:
- Optional[dict]: 记录存在返回字段-值字典,否则返回 None
+ dict | None: 记录存在返回字段-值字典,否则返回 None
"""
cursor = await cls.m_pDB.execute(
"SELECT * FROM userSoil WHERE uid = ? AND soilIndex = ?",
diff --git a/farm/farm.py b/farm/farm.py
index ee9735d..25d8531 100644
--- a/farm/farm.py
+++ b/farm/farm.py
@@ -243,10 +243,16 @@ class CFarmManager:
soilInfo = await g_pDBService.userSoil.getUserSoil(uid, i)
if soilInfo:
- if soilInfo["soilLevel"] == 1:
- iconPath = g_sResourcePath / "soil/红土地.png"
- else:
- iconPath = g_sResourcePath / "soil/普通土地.png"
+ match soilInfo.get("soilLevel", 0):
+ case 1:
+ name = "红土地.png"
+ case 2:
+ name = "黑土地.png"
+ case 3:
+ name = "金土地.png"
+ case _:
+ name = "普通土地.png"
+ iconPath = g_sResourcePath / "soil" / name
if iconPath.exists():
icon = (iconPath, 33, 33)
diff --git a/request.py b/request.py
index 9ca28ac..5eae182 100644
--- a/request.py
+++ b/request.py
@@ -31,7 +31,7 @@ class CRequestManager:
params: dict | None = None,
jsonData: dict | None = None,
) -> bool:
- """下载文件到指定路径并覆盖已存在的文件,并显示下载进度条
+ """下载文件到指定路径并覆盖已存在的文件
Args:
url (str): 文件的下载链接
@@ -210,7 +210,6 @@ class CRequestManager:
# 重命名为 sign_in.json
g_pToolManager.renameFile(f"{path}/signTemp.json", "sign_in.json")
return True
-
except Exception as e:
logger.error("下载签到文件失败", e=e)
return False