update pay function

This commit is contained in:
2025-11-23 23:17:12 +08:00
parent 3c7b55226c
commit 0a149eaa0f

6
app.py
View File

@@ -4633,7 +4633,7 @@ class PredictionTransaction(db.Model):
topic_id = db.Column(db.Integer, db.ForeignKey('prediction_topic.id'), nullable=False)
# 交易信息
transaction_type = db.Column(db.String(10), nullable=False) # buy/sell
trade_type = db.Column(db.String(10), nullable=False) # buy/sell
direction = db.Column(db.String(3), nullable=False) # yes/no
shares = db.Column(db.Integer, nullable=False) # 份额数量
price = db.Column(db.Float, nullable=False) # 成交价格
@@ -4650,7 +4650,7 @@ class PredictionTransaction(db.Model):
user = db.relationship('User', backref='prediction_transactions')
def __repr__(self):
return f'<PredictionTransaction id={self.id} type={self.transaction_type} shares={self.shares}>'
return f'<PredictionTransaction id={self.id} type={self.trade_type} shares={self.shares}>'
class CreditTransaction(db.Model):
@@ -13987,7 +13987,7 @@ def buy_prediction_shares():
transaction = PredictionTransaction(
user_id=current_user.id,
topic_id=topic_id,
transaction_type='buy',
trade_type='buy',
direction=direction,
shares=shares,
price=avg_price,