diff --git a/database.py b/database.py index e04ce19..01f208c 100644 --- a/database.py +++ b/database.py @@ -221,13 +221,7 @@ class CSqlManager: return -1 try: - async with cls.m_pDB.execute( - """UPDATE user - SET point = ? - WHERE uid = ? - RETURNING point""", - (point, uid) - ) as cursor: + async with cls.m_pDB.execute(f"UPDATE user SET point = {point} WHERE uid = '{uid}'") as cursor: async for row in cursor: return int(row[0]) @@ -235,7 +229,7 @@ class CSqlManager: return -1 except Exception as e: # 记录详细错误日志(建议记录堆栈) - logger.error(f"更新失败: {e}") + logger.error(f"金币更新失败: {e}") return -1 @classmethod diff --git a/farm/farm.py b/farm/farm.py index 31fdc4f..16f326b 100644 --- a/farm/farm.py +++ b/farm/farm.py @@ -374,7 +374,7 @@ class CFarmManager: experience = 0 for (soil_name, (status, info)) in zip(soilNames, soilStatuses): - if not status: + if not info: soilInfo = info.split(',') if int(soilInfo[3]) == 4: experience += 3 @@ -505,11 +505,14 @@ class CFarmManager: harvestRecords: List[str] = [] isStealing = False - for(soilName, (status, info)) in zip(soilNames, soilStatuses): + for (soilName, (status, info)) in zip(soilNames, soilStatuses): isStealing = False - if not status: + if not info: soilInfo = info.split(',') + if soilInfo[3] == 4: + continue + plantId = soilInfo[0] plantInfo = g_pJsonManager.m_pPlant['plant'][plantId] # type: ignore @@ -542,7 +545,8 @@ class CFarmManager: plant[plantId] = plant.get(plantId, 0) + randomNumber harvestRecords.append(f"成功偷到作物:{plantId},数量为:{randomNumber}") - stealingStatus += f"|{uid}-{randomNumber}" + newElement = f"|{uid}-{randomNumber}" + stealingStatus.append(newElement) #如果将作物偷完,就直接更新状态 并记录用户偷取过 if plantInfo['harvest'] - randomNumber + stealingNumber == 0: