diff --git a/app/models/merchant_product.py b/app/models/merchant_product.py index 62792b9..9330cc7 100644 --- a/app/models/merchant_product.py +++ b/app/models/merchant_product.py @@ -25,6 +25,7 @@ class MerchantProductDB(Base): tags = Column(String(200)) # 标签,逗号分隔 purchase_limit = Column(Integer, nullable=False, default=0) # 限购次数,0表示不限购 gift_points_rate = Column(DECIMAL(4,2), nullable=False, default=0.00) # 购买赠送积分比例,默认0% + promotion_text = Column(String(100)) # 促销文本 create_time = Column(DateTime(timezone=True), server_default=func.now()) update_time = Column(DateTime(timezone=True), onupdate=func.now()) status = Column(Enum(ProductStatus), nullable=False, default=ProductStatus.UNLISTING) @@ -41,6 +42,7 @@ class MerchantProductCreate(BaseModel): tags: str = Field("", max_length=200) purchase_limit: int = Field(0, ge=0) # 限购次数,默认0表示不限购 status: ProductStatus = ProductStatus.UNLISTING + promotion_text: Optional[str] = Field(None, max_length=100) # 促销文本 gift_points_rate: Optional[float] = Field(10.00, ge=0, le=100) # 购买赠送积分比例 class MerchantProductUpdate(BaseModel): @@ -52,6 +54,7 @@ class MerchantProductUpdate(BaseModel): tags: Optional[str] = Field(None, max_length=200) purchase_limit: Optional[int] = Field(None, ge=0) # 限购次数,可选字段 status: Optional[ProductStatus] = None + promotion_text: Optional[str] = Field(None, max_length=100) # 促销文本 gift_points_rate: Optional[float] = Field(None, ge=0, le=100) # 购买赠送积分比例 class MerchantProductInfo(BaseModel): @@ -66,6 +69,7 @@ class MerchantProductInfo(BaseModel): tags: str purchase_limit: int # 限购次数 gift_points_rate: float + promotion_text: Optional[str] = None # 促销文本 create_time: datetime update_time: Optional[datetime] status: ProductStatus