update pay function

This commit is contained in:
2025-11-23 22:06:07 +08:00
parent 1f1aa896d1
commit dca70074c0
4 changed files with 627 additions and 2 deletions

13
app.py
View File

@@ -13591,6 +13591,15 @@ def get_prediction_topics():
total_shares = topic.yes_total_shares + topic.no_total_shares
yes_prob = (topic.yes_total_shares / total_shares * 100) if total_shares > 0 else 50.0
# 处理datetime确保移除时区信息
deadline = topic.deadline
if hasattr(deadline, 'replace') and deadline.tzinfo is not None:
deadline = deadline.replace(tzinfo=None)
created_at = topic.created_at
if hasattr(created_at, 'replace') and created_at.tzinfo is not None:
created_at = created_at.replace(tzinfo=None)
topics_data.append({
'id': topic.id,
'title': topic.title,
@@ -13613,8 +13622,8 @@ def get_prediction_topics():
'nickname': topic.no_lord.nickname or topic.no_lord.username,
'avatar_url': topic.no_lord.avatar_url
} if topic.no_lord else None,
'deadline': topic.deadline.isoformat(),
'created_at': topic.created_at.isoformat(),
'deadline': deadline.isoformat() if deadline else None,
'created_at': created_at.isoformat() if created_at else None,
'views_count': topic.views_count,
'comments_count': topic.comments_count,
'participants_count': topic.participants_count,