1.尝试修复签到不加分的错误2.移除注册时间显示
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -181,3 +181,6 @@ cython_debug/
|
||||
.cursorindexingignore
|
||||
# IDE
|
||||
.vscode/
|
||||
|
||||
# Database
|
||||
data/
|
||||
@@ -544,12 +544,16 @@ class Database:
|
||||
today = datetime.now().strftime('%Y-%m-%d')
|
||||
|
||||
if self.check_daily_checkin(user_id, today):
|
||||
logger.warning(f"用户 {user_id} 今日已签到")
|
||||
return False
|
||||
|
||||
cursor = self.conn.cursor()
|
||||
current_time = int(time.time())
|
||||
|
||||
try:
|
||||
# 确保用户存在
|
||||
self.get_or_create_user(user_id)
|
||||
|
||||
# 记录签到
|
||||
cursor.execute(
|
||||
"INSERT INTO daily_checkins (user_id, checkin_date, points_earned, created_at) VALUES (?, ?, ?, ?)",
|
||||
@@ -557,10 +561,12 @@ class Database:
|
||||
)
|
||||
|
||||
# 添加积分
|
||||
return self.add_points(user_id, points, "daily_checkin", f"每日签到奖励")
|
||||
result = self.add_points(user_id, points, "daily_checkin", f"每日签到奖励")
|
||||
logger.info(f"用户 {user_id} 签到结果: {result}, 积分: {points}")
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"每日签到失败: {e}")
|
||||
logger.error(f"每日签到失败: {e}", exc_info=True)
|
||||
return False
|
||||
|
||||
def get_points_leaderboard(self, limit: int = 10) -> List[Dict]:
|
||||
|
||||
BIN
data/bot.db
BIN
data/bot.db
Binary file not shown.
@@ -71,20 +71,25 @@ class PointsGame(BaseGame):
|
||||
return f"❌ 今日已签到,明天再来吧!\n\n📅 签到日期:{today}"
|
||||
|
||||
# 执行签到
|
||||
if self.db.daily_checkin(user_id, checkin_points):
|
||||
# 获取用户积分信息
|
||||
points_info = self.db.get_user_points(user_id)
|
||||
|
||||
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"📅 签到日期:{today}\n\n"
|
||||
text += "💡 提示:每天签到可获得固定积分奖励!"
|
||||
|
||||
return text
|
||||
else:
|
||||
return "❌ 签到失败,请稍后重试"
|
||||
try:
|
||||
result = self.db.daily_checkin(user_id, checkin_points)
|
||||
if result:
|
||||
# 获取用户积分信息
|
||||
points_info = self.db.get_user_points(user_id)
|
||||
|
||||
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"📅 签到日期:{today}\n\n"
|
||||
text += "💡 提示:每天签到可获得固定积分奖励!"
|
||||
|
||||
return text
|
||||
else:
|
||||
return "❌ 签到失败,请稍后重试"
|
||||
except Exception as e:
|
||||
logger.error(f"签到过程中发生错误: {e}", exc_info=True)
|
||||
return f"❌ 签到过程中发生错误: {str(e)}"
|
||||
|
||||
def _get_user_points(self, user_id: int) -> str:
|
||||
"""获取用户积分信息
|
||||
@@ -100,7 +105,6 @@ class PointsGame(BaseGame):
|
||||
text = f"## 💎 个人积分\n\n"
|
||||
text += f"**可用积分**:{points_info['available_points']} 分\n\n"
|
||||
text += f"**总积分**:{points_info['total_points']} 分\n\n"
|
||||
text += f"**注册时间**:{datetime.fromtimestamp(points_info['created_at']).strftime('%Y-%m-%d %H:%M')}\n\n"
|
||||
text += "---\n\n"
|
||||
text += "💡 提示:\n"
|
||||
text += "• 每日签到可获得 10 积分\n"
|
||||
|
||||
Reference in New Issue
Block a user