- config.json 改为按项目存储(projects.<id>),上传配置全局共用;旧单项目配置自动迁移为 readoor
- 新增项目管理(管理员):Git 仓库/凭据、源码目录、Xcode 工程、拷贝条目、配置替换方式、自定义字段、替换规则
- 通用配置替换:pbxproj 版本号与签名,patch_rules 支持 define / replace_line 及 ${app.X}、${server.X} 模板
- 请求通过 X-Project 头选择项目;打包任务记录 project_id,历史按项目过滤
- 前端顶部切换项目,App/服务器环境表单按项目显示字段
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87 lines
2.8 KiB
Python
87 lines
2.8 KiB
Python
"""数据库模型"""
|
|
from datetime import datetime
|
|
from sqlalchemy import Column, String, Boolean, Text, TIMESTAMP
|
|
from .database import Base
|
|
|
|
|
|
class Task(Base):
|
|
"""打包任务表"""
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(String, primary_key=True)
|
|
project_id = Column(String, default="readoor") # 所属项目,见 projects.py
|
|
app_id = Column(String, nullable=False)
|
|
app_name = Column(String, nullable=False)
|
|
build_type = Column(String, nullable=False)
|
|
scheme_id = Column(String, nullable=False)
|
|
scheme_name = Column(String, nullable=False)
|
|
obfuscation = Column(Boolean, default=False)
|
|
branch = Column(String, default="main") # 分支名或 Tag 名,由 ref_type 区分
|
|
ref_type = Column(String, default="branch") # branch/tag
|
|
|
|
# 状态
|
|
status = Column(String, default="pending") # pending/running/completed/failed/cancelled
|
|
current_step = Column(String)
|
|
|
|
# 时间
|
|
created_at = Column(TIMESTAMP, default=datetime.utcnow)
|
|
started_at = Column(TIMESTAMP)
|
|
completed_at = Column(TIMESTAMP)
|
|
# 同一 OSS 对象被后续成功打包覆盖时标记;默认历史列表不展示。
|
|
superseded_at = Column(TIMESTAMP)
|
|
|
|
# 产物
|
|
ipa_path = Column(String)
|
|
oss_url = Column(String)
|
|
dsym_path = Column(String)
|
|
dsym_url = Column(String)
|
|
obfuscation_maps_path = Column(String)
|
|
qr_code_path = Column(String)
|
|
build_dir = Column(String)
|
|
|
|
# 错误
|
|
error_message = Column(Text)
|
|
error_category = Column(String) # certificate/provisioning/compilation/dependency/git/config/build/unknown
|
|
|
|
# 配置快照
|
|
config_json = Column(Text)
|
|
|
|
|
|
class BuildConfig(Base):
|
|
"""打包配置表"""
|
|
__tablename__ = "build_config"
|
|
|
|
key = Column(String, primary_key=True)
|
|
value = Column(String)
|
|
updated_at = Column(TIMESTAMP, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
class User(Base):
|
|
"""用户表"""
|
|
__tablename__ = "users"
|
|
|
|
id = Column(String, primary_key=True)
|
|
username = Column(String, unique=True, nullable=False)
|
|
password_hash = Column(String, nullable=False)
|
|
is_admin = Column(Boolean, default=False)
|
|
created_at = Column(TIMESTAMP, default=datetime.utcnow)
|
|
|
|
|
|
class OperationLog(Base):
|
|
"""用户关键操作的审计与统计记录。"""
|
|
__tablename__ = "operation_logs"
|
|
|
|
id = Column(String, primary_key=True)
|
|
created_at = Column(TIMESTAMP, default=datetime.utcnow, nullable=False)
|
|
username = Column(String, nullable=False)
|
|
is_admin = Column(Boolean, default=False, nullable=False)
|
|
action = Column(String, nullable=False)
|
|
task_id = Column(String)
|
|
app_id = Column(String)
|
|
app_name = Column(String)
|
|
resource_type = Column(String)
|
|
resource_name = Column(String)
|
|
detail_json = Column(Text)
|
|
client_ip = Column(String)
|
|
user_agent = Column(String)
|