🐛 将获取用户基本信息的地方全部转交给Player类

This commit is contained in:
2025-10-22 21:58:58 +08:00
parent 1be91147c1
commit 5c043bc0c8
7 changed files with 91 additions and 126 deletions
+22 -2
View File
@@ -185,7 +185,27 @@ class CPlayer:
return await g_pDBService.user.getUserLevelByUid(uid)
async def updateField(self, field: str) -> bool:
async def updateStealCountByUid(
self, uid: str, stealTime: str, stealCount: int
) -> bool:
"""根据用户Uid更新剩余偷菜次数
Args:
uid (str): 用户Uid
stealTime (str): 偷菜日期
stealCount (int): 新剩余偷菜次数
Returns:
bool: 是否更新成功
"""
uid = self.user.get("uid", "")
if uid == "":
return False
return await g_pDBService.user.updateStealCountByUid(uid, stealTime, stealCount)
async def updateField(self, field: str, value) -> bool:
"""更新单字段信息
Returns:
@@ -196,4 +216,4 @@ class CPlayer:
if uid == "":
return False
return await g_pDBService.farm.updateFarmFieldByUid(uid)
return await g_pDBService.user.updateFieldByUid(uid, field, value)