7b62c2f8b4
## H5 底部导航修复 (Bug #10) - 精简 App.vue,移除重复 tabbar,仅保留全局样式 - uni-page 设置 height: calc(100% - 50px) + overflow-y: auto - 内容区域精确停在底部导航上方,独立滚动不再叠加 - 恢复 custom-tab-bar 组件 ## 项目进度文档 - PROGRESS.md 更新至 10 个 Bug 修复 - 新增 H5 底部导航修复记录 - 新增历史变更条目
56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
from sqlalchemy import Column, String, Boolean, Integer, DateTime, Text, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID, JSONB
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
from app.database import Base
|
|
import uuid
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
wechat_openid = Column(String(255), unique=True, index=True)
|
|
phone = Column(String(20), unique=True, index=True)
|
|
username = Column(String(100))
|
|
password_hash = Column(String(255))
|
|
tier = Column(String(50), default="free")
|
|
role = Column(String(20), default="user")
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
settings = Column(JSONB, default={
|
|
"preferred_translate_provider": "auto",
|
|
"reply_tone": "professional",
|
|
"timezone": "Asia/Shanghai",
|
|
"languages": ["zh", "en"],
|
|
})
|
|
|
|
products = relationship("Product", back_populates="user", cascade="all, delete-orphan")
|
|
customers = relationship("Customer", back_populates="user", cascade="all, delete-orphan")
|
|
conversations = relationship("Conversation", back_populates="user", cascade="all, delete-orphan")
|
|
quotations = relationship("Quotation", back_populates="user", cascade="all, delete-orphan")
|
|
|
|
|
|
class Product(Base):
|
|
__tablename__ = "products"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
user_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=False, index=True)
|
|
name = Column(String(255), nullable=False)
|
|
name_en = Column(String(255))
|
|
description = Column(Text)
|
|
description_en = Column(Text)
|
|
category = Column(String(100))
|
|
price = Column(String(50))
|
|
price_unit = Column(String(20), default="USD")
|
|
moq = Column(String(50))
|
|
keywords = Column(JSONB, default=[])
|
|
specifications = Column(JSONB, default={})
|
|
images = Column(JSONB, default=[])
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
user = relationship("User", back_populates="products")
|