去除原来的签到级别设计

This commit is contained in:
liuwei
2025-11-18 16:23:30 +08:00
parent 85d5fb2746
commit 7c5051cca6
3 changed files with 75 additions and 30 deletions

View File

@@ -8,7 +8,6 @@ from typing import Callable, Dict, Any, Tuple
from db.stats_db import StatsDBOperator
from db.connection import DBConnectionManager
from db.levels_db import LevelsDBOperator
def plugin_stats_decorator(plugin_name: str) -> Callable:
@@ -69,9 +68,7 @@ def plugin_stats_decorator(plugin_name: str) -> Callable:
process_time_ms=process_time_ms
)
logger.info(f"[{plugin_name}] 成功记录插件调用: {command}, 耗时: {process_time_ms:.2f}ms")
if success and sender:
levels_db = LevelsDBOperator(db_manager)
levels_db.add_exp(sender, roomid or sender, 2, "plugin_call")
# 定义不需要记录错误的正常业务状态
normal_responses = {

View File

@@ -7,7 +7,6 @@ from typing import Callable, Dict, Any, Tuple, Union
from db.connection import DBConnectionManager
from db.points_db import PointsDBOperator, PointSource
from db.levels_db import LevelsDBOperator
from utils.revoke.message_auto_revoke import MessageAutoRevoke
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
from wechat_ipad import WechatAPIClient
@@ -87,8 +86,6 @@ def points_reward_decorator(points_calculator: Union[int, Callable], source_type
logger.info(f"PointsReward.{self.name if hasattr(self, 'name') else 'Unknown'}")
if reward_success:
logger.info(f"用户 {sender} 获得 {points} 积分奖励")
levels_db = LevelsDBOperator(db_manager)
ok, lvl = levels_db.add_exp(sender, roomid, points, source.value)
if "积分" not in response:
response += f"\n🎁 恭喜获得 {points} 积分奖励!"
client_msg_id, create_time, new_msg_id = await bot.send_at_message(
@@ -96,19 +93,6 @@ def points_reward_decorator(points_calculator: Union[int, Callable], source_type
response, [sender]
)
revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 5)
if ok and isinstance(lvl, dict) and "level" in lvl and "exp" in lvl:
title = levels_db.level_title(int(lvl['level']))
level_msg = f"🔰 当前等级: {lvl['level']}{title} 经验: {lvl['exp']}"
_, cur_t, next_t, pct, remain = levels_db.get_progress(int(lvl['exp']))
if next_t is None:
level_msg += "\n📈 进度: 已满级"
else:
level_msg += f"\n📈 进度: {int(pct*100)}%(还差 {remain}"
client_msg_id, create_time, new_msg_id = await bot.send_at_message(
(roomid if roomid else sender),
level_msg, [sender]
)
revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 5)
else:
logger.warning(f"用户 {sender} 积分奖励失败: {reward_result}")
except Exception as e:
@@ -174,20 +158,10 @@ def points_reward_decorator(points_calculator: Union[int, Callable], source_type
logger.info(f"PointsReward.{self.name if hasattr(self, 'name') else 'Unknown'}")
if reward_success:
logger.info(f"用户 {sender} 获得 {points} 积分奖励")
levels_db = LevelsDBOperator(db_manager)
ok, lvl = levels_db.add_exp(sender, roomid, points, source.value)
# 如果响应中没有提到积分,添加积分信息
if "积分" not in response:
response += f"\n🎁 恭喜获得 {points} 积分奖励!"
if ok and isinstance(lvl, dict) and "level" in lvl and "exp" in lvl:
title = levels_db.level_title(int(lvl['level']))
response += f"\n🔰 当前等级: {lvl['level']}{title} 经验: {lvl['exp']}"
_, cur_t, next_t, pct, remain = levels_db.get_progress(int(lvl['exp']))
if next_t is None:
response += "\n📈 进度: 已满级"
else:
response += f"\n📈 进度: {int(pct*100)}%(还差 {remain}"
else:
logger.warning(f"用户 {sender} 积分奖励失败: {reward_result}")
except Exception as e: