mirror of
https://github.com/Shu-Ying/main_plugin_farm.git
synced 2026-10-29 21:59:58 +08:00
🎨 添加收获次数判断作物升星,一二三四五星作物写入库中
This commit is contained in:
@@ -75,6 +75,24 @@ class CUserPlantCountDB(CSqlManager):
|
||||
rows = await cursor.fetchall()
|
||||
return {row["plant"]: row["count"] for row in rows}
|
||||
|
||||
@classmethod
|
||||
async def getUserPlantCountByPlantName(cls, uid: str, plant: str) -> int:
|
||||
"""根据用户Uid和植物名称获取该对应的收获次数
|
||||
|
||||
Args:
|
||||
uid (str): 用户uid
|
||||
plant (str): 植物名称
|
||||
|
||||
Returns:
|
||||
int: 收获次数
|
||||
"""
|
||||
cursor = await cls.m_pDB.execute(
|
||||
"SELECT count FROM userPlantCount WHERE uid = ? AND plant = ?",
|
||||
(uid, plant),
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
return row["count"] if row else 0
|
||||
|
||||
@classmethod
|
||||
async def updateUserPlantCountByName(cls, uid: str, plant: str, count: int) -> bool:
|
||||
"""根据植物名称更新植物的收获次数
|
||||
|
||||
Reference in New Issue
Block a user