diff --git a/utils/decorator/points_decorator.py b/utils/decorator/points_decorator.py index c221553..b877dcf 100644 --- a/utils/decorator/points_decorator.py +++ b/utils/decorator/points_decorator.py @@ -134,21 +134,14 @@ def plugin_points_cost(points: int, description: str = None, feature: Feature = logger = logging.getLogger(f"PointsCost.{plugin_name}") user_points = points_db.get_user_points(sender, roomid) - stats = points_db.get_user_points_stats(roomid) - try: - points_auto = int(points * stats["total_points"] / 3000) - except Exception as e: - logger.error(f"计算抵扣积分错误,使用默认积分:{e}") - points_auto = points - - if user_points["total_points"] < points_auto: + if user_points["total_points"] < points: # 积分不足 wcf = message.get("wcf") if wcf: wcf.send_text( f"❌ 积分不足\n无法使用 {plugin_name} 功能\n" f"🪙 先参与积分活动[签到,答题/t]赚取吧!\n" - f"💰 有: {user_points['total_points']} | 需: {points_auto} |差: {points_auto - user_points['total_points']} ", + f"💰 有: {user_points['total_points']} | 需: {points} |差: {points - user_points['total_points']} ", (roomid if roomid else sender), sender ) logger.info(f"用户 {sender} 积分不足,无法使用功能") @@ -160,20 +153,20 @@ def plugin_points_cost(points: int, description: str = None, feature: Feature = # 如果原始方法执行成功,扣除积分 if success: deduct_success, deduct_result = points_db.deduct_points( - sender, roomid, points_auto, PointSource.PLUGIN, + sender, roomid, points, PointSource.PLUGIN, description or f"使用 {plugin_name} 功能" ) if deduct_success: - logger.info(f"用户 {sender} 使用 {plugin_name} 功能扣除 {points_auto} 积分") + logger.info(f"用户 {sender} 使用 {plugin_name} 功能扣除 {points} 积分") # 如果响应中没有提到积分,添加积分信息 if "积分" not in response: - response += f"\n\n💰 已消费 {points_auto} 积分" + response += f"\n\n💰 已消费 {points} 积分" wcf = message.get("wcf") if wcf: wcf.send_text( - f"💰消费 {points_auto} 积分", + f"💰消费 {points} 积分", (roomid if roomid else sender), sender ) else: