1.尝试修复积分系统2.大幅度简化积分系统

This commit is contained in:
2025-10-29 12:29:18 +08:00
parent 7b72ed9f34
commit 0c2638e948
2 changed files with 39 additions and 451 deletions

View File

@@ -41,9 +41,6 @@ class PointsGame(BaseGame):
elif args in ['leaderboard', '排行榜', '排行']:
return self._get_leaderboard()
# 积分记录
elif args in ['records', '记录', '历史']:
return self._get_points_records(user_id)
# 默认:查看个人积分
else:
@@ -79,8 +76,7 @@ class PointsGame(BaseGame):
text = f"## ✅ 签到成功!\n\n"
text += f"**获得积分**+{checkin_points}\n\n"
text += f"**当前积分**{points_info['available_points']}\n\n"
text += f"**总积分**{points_info['total_points']}\n\n"
text += f"**当前积分**{points_info['points']}\n\n"
text += f"📅 签到日期:{today}\n\n"
text += "💡 提示:每天签到可获得固定积分奖励!"
@@ -103,49 +99,15 @@ class PointsGame(BaseGame):
points_info = self.db.get_user_points(user_id)
text = f"## 💎 个人积分\n\n"
text += f"**可用积分**{points_info['available_points']}\n\n"
text += f"**总积分**{points_info['total_points']}\n\n"
text += f"**当前积分**{points_info['points']}\n\n"
text += "---\n\n"
text += "💡 提示:\n"
text += "• 每日签到可获得 10 积分\n"
text += "• 查看运势可获得随机积分\n"
text += "• 使用 `.points records` 查看积分记录"
text += "• 使用 `.points leaderboard` 查看排行榜"
return text
def _get_points_records(self, user_id: int, limit: int = 10) -> str:
"""获取用户积分记录
Args:
user_id: 用户ID
limit: 限制数量
Returns:
积分记录消息
"""
records = self.db.get_points_records(user_id, limit)
if not records:
return "📝 暂无积分记录"
text = f"## 📝 积分记录(最近 {len(records)} 条)\n\n"
for record in records:
timestamp = datetime.fromtimestamp(record['created_at']).strftime('%m-%d %H:%M')
points_str = f"+{record['points']}" if record['points'] > 0 else str(record['points'])
source_map = {
'daily_checkin': '每日签到',
'fortune': '运势奖励',
'game_reward': '游戏奖励'
}
source = source_map.get(record['source'], record['source'])
text += f"**{timestamp}** {points_str} 分 - {source}\n"
if record.get('description'):
text += f" *{record['description']}*\n"
text += "\n"
return text
def _get_leaderboard(self, limit: int = 10) -> str:
"""获取积分排行榜
@@ -169,11 +131,10 @@ class PointsGame(BaseGame):
rank = i + 1
medal = medals[i] if i < len(medals) else "🏅"
username = user.get('username', f"用户{user['user_id']}")
total_points = user.get('total_points', 0)
available_points = user.get('available_points', 0)
points = user.get('points', 0)
text += f"{medal} **第 {rank} 名** {username}\n"
text += f" 积分:{total_points} 分 | 可用:{available_points}\n\n"
text += f" 积分:{points}\n\n"
text += "---\n\n"
text += "💡 提示:使用 `.points` 查看个人积分"
@@ -207,7 +168,6 @@ class PointsGame(BaseGame):
- `.points` - 查看个人积分
- `.checkin` - 每日签到
- `.points leaderboard` - 积分排行榜
- `.points records` - 积分记录
### 积分获取方式
- **每日签到**:固定 10 积分
@@ -219,11 +179,10 @@ class PointsGame(BaseGame):
.points
.checkin
.points leaderboard
.points records
```
### 说明
- 每日签到只能进行一次
- 运势积分每次查看都有机会获得
- 积分记录保留最近 20 条
- 积分系统已简化,不再保留历史记录
"""