update pay function
This commit is contained in:
6
app.py
6
app.py
@@ -4633,7 +4633,7 @@ class PredictionTransaction(db.Model):
|
|||||||
topic_id = db.Column(db.Integer, db.ForeignKey('prediction_topic.id'), nullable=False)
|
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
|
direction = db.Column(db.String(3), nullable=False) # yes/no
|
||||||
shares = db.Column(db.Integer, nullable=False) # 份额数量
|
shares = db.Column(db.Integer, nullable=False) # 份额数量
|
||||||
price = db.Column(db.Float, nullable=False) # 成交价格
|
price = db.Column(db.Float, nullable=False) # 成交价格
|
||||||
@@ -4650,7 +4650,7 @@ class PredictionTransaction(db.Model):
|
|||||||
user = db.relationship('User', backref='prediction_transactions')
|
user = db.relationship('User', backref='prediction_transactions')
|
||||||
|
|
||||||
def __repr__(self):
|
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):
|
class CreditTransaction(db.Model):
|
||||||
@@ -13987,7 +13987,7 @@ def buy_prediction_shares():
|
|||||||
transaction = PredictionTransaction(
|
transaction = PredictionTransaction(
|
||||||
user_id=current_user.id,
|
user_id=current_user.id,
|
||||||
topic_id=topic_id,
|
topic_id=topic_id,
|
||||||
transaction_type='buy',
|
trade_type='buy',
|
||||||
direction=direction,
|
direction=direction,
|
||||||
shares=shares,
|
shares=shares,
|
||||||
price=avg_price,
|
price=avg_price,
|
||||||
|
|||||||
Reference in New Issue
Block a user