🚑 修复土地等级绘制出错的BUG
This commit is contained in:
parent
f4e192ff27
commit
e48bdf03da
@ -8,6 +8,9 @@
|
||||
<a href="https://www.python.org">
|
||||
<img src="https://img.shields.io/badge/Python-3.10%2B-blue" alt="Python">
|
||||
</a>
|
||||
<a href="https://github.com/astral-sh/ruff">
|
||||
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json" alt="ruff">
|
||||
</a>
|
||||
<a href="https://nonebot.dev/">
|
||||
<img src="https://img.shields.io/badge/Nonebot-2.0.0%2B-black" alt="Nonebot">
|
||||
</a>
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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 = ?",
|
||||
|
||||
14
farm/farm.py
14
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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user