实现农场币换点券、查看当前用户点券,偷偷加后门改农场币。

This commit is contained in:
Mualamx
2025-10-10 10:58:46 +08:00
parent aa2c5811de
commit 01fceaa4fe
4 changed files with 102 additions and 0 deletions
+22
View File
@@ -1106,5 +1106,27 @@ class CFarmManager:
text=g_sTranslation["soilInfo"][soilLevelText],
)
@classmethod
async def pointToVipPointByUid(cls, uid: str, num: int) -> str:
if num <= 0:
return "点券兑换数量必须大于0"
pro = float(Config.get_config("zhenxun_plugin_farm", "点券兑换倍数"))
pro *= float(num)
point = await g_pDBService.user.getUserPointByUid(uid)
if point < pro:
return f"你的农场币不足,当前农场币为{point},兑换还需要{pro - point}农场币"
point -= pro
await g_pDBService.user.updateUserPointByUid(uid, int(point))
p = await g_pDBService.user.getUserVipPointByUid(uid)
number = float(num) + p
await g_pDBService.user.updateUserVipPointByUid(uid, int(number))
return f"兑换{num}点券成功,当前点券:{number},当前农场币:{point}"
g_pFarmManager = CFarmManager()