54 lines
1.9 KiB
Python
54 lines
1.9 KiB
Python
|
|
from sqlalchemy import Column, String, Text, Float, Date, Boolean, Integer, DateTime
|
|||
|
|
from sqlalchemy.sql import func
|
|||
|
|
from app.core.database import Base
|
|||
|
|
import uuid
|
|||
|
|
|
|||
|
|
def generate_uuid():
|
|||
|
|
return str(uuid.uuid4())
|
|||
|
|
|
|||
|
|
class DealInfo(Base):
|
|||
|
|
__tablename__ = "deal_info"
|
|||
|
|
|
|||
|
|
id = Column(String(36), primary_key=True, default=generate_uuid)
|
|||
|
|
user_id = Column(String(36), nullable=True, index=True)
|
|||
|
|
|
|||
|
|
# 标题和内容
|
|||
|
|
title = Column(String(255), nullable=False)
|
|||
|
|
content = Column(Text, nullable=True)
|
|||
|
|
|
|||
|
|
# 成交信息
|
|||
|
|
deal_price = Column(Float, nullable=True) # 成交价格
|
|||
|
|
deal_date = Column(Date, nullable=True) # 成交日期
|
|||
|
|
deal_no = Column(String(20), nullable=True, index=True) # 行情编号(从A000001开始递增)
|
|||
|
|
|
|||
|
|
# 包装和分类
|
|||
|
|
packaging = Column(String(50), nullable=True) # 包装(标百/标十/单张)
|
|||
|
|
category = Column(String(100), nullable=True) # 分类
|
|||
|
|
|
|||
|
|
# 评级相关
|
|||
|
|
is_graded = Column(Boolean, default=False) # 是否评级
|
|||
|
|
grading_company = Column(String(100), nullable=True) # 评级机构
|
|||
|
|
grading_score = Column(String(50), nullable=True) # 评级分数
|
|||
|
|
|
|||
|
|
# 号码特征
|
|||
|
|
tail_number = Column(String(10), nullable=True) # 尾号
|
|||
|
|
size_type = Column(String(20), nullable=True) # 大小号
|
|||
|
|
|
|||
|
|
# 版别
|
|||
|
|
version = Column(String(50), nullable=True) # 版别
|
|||
|
|
|
|||
|
|
# 交易信息
|
|||
|
|
platform = Column(String(50), nullable=True) # 成交平台
|
|||
|
|
seller = Column(String(100), nullable=True) # 出售者
|
|||
|
|
buyer = Column(String(100), nullable=True) # 购买者
|
|||
|
|
|
|||
|
|
# 状态
|
|||
|
|
status = Column(String(20), default="active")
|
|||
|
|
|
|||
|
|
# 统计
|
|||
|
|
view_count = Column(Integer, default=0)
|
|||
|
|
contact_count = Column(Integer, default=0)
|
|||
|
|
|
|||
|
|
# 时间
|
|||
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|||
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|