From 2ab88b9fcaaa691b9f4c6963540973c877c1a2ff Mon Sep 17 00:00:00 2001 From: aaron <> Date: Mon, 3 Feb 2025 20:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=83=E9=94=80=E6=96=87?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/merchant_product.py | 4 ++++ 1 file changed, 4 insertions(+) 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