feat: 平台配置表扩展配图/字数字段,微信公众号正文插入配图,合规检查从DB读规则
- PlatformConfig模型新增requires_image、image_count_min/max、image_width/height、min_words/max_words - schemas.py同步PlatformConfigBase/Create/Update/Response新字段 - initial_data.py为三大平台填充初始值(微信需配图、字数800-1500等) - database.py添加新列ALTER TABLE迁移 - platforms.html重写编辑弹窗(正确字段名+配图/字数设置) - writer.py微信公众号文章正文h1后插入<img>占位 - compliance_checker.py接受platform_config参数,从DB读取规则替代硬编码 - compliance_optimizer.py启动时加载DB平台配置传入checker
This commit is contained in:
@@ -361,6 +361,13 @@ class PlatformConfig(Base):
|
||||
compliance_rules = Column(JSON, default=dict)
|
||||
default_format = Column(Text, nullable=True)
|
||||
is_active = Column(Boolean, default=True)
|
||||
requires_image = Column(Boolean, default=False)
|
||||
image_count_min = Column(Integer, default=0)
|
||||
image_count_max = Column(Integer, default=0)
|
||||
image_width = Column(Integer, default=0)
|
||||
image_height = Column(Integer, default=0)
|
||||
min_words = Column(Integer, default=0)
|
||||
max_words = Column(Integer, default=0)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
@@ -375,6 +382,13 @@ class PlatformConfig(Base):
|
||||
"compliance_rules": self.compliance_rules or {},
|
||||
"default_format": self.default_format,
|
||||
"is_active": self.is_active,
|
||||
"requires_image": self.requires_image,
|
||||
"image_count_min": self.image_count_min,
|
||||
"image_count_max": self.image_count_max,
|
||||
"image_width": self.image_width,
|
||||
"image_height": self.image_height,
|
||||
"min_words": self.min_words,
|
||||
"max_words": self.max_words,
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None,
|
||||
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user