All checks were successful
continuous-integration/drone/push Build is passing
- 后端: App 模型添加 config_schema 字段,支持配置项定义 - 后端: apps API 支持 config_schema 的增删改查 - 前端: 应用管理页面支持定义配置项(text/radio/select/switch类型) - 前端: 租户订阅页面根据应用 schema 动态渲染对应表单控件 - 支持设置选项、默认值、必填等属性
32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
"""应用定义模型"""
|
||
from datetime import datetime
|
||
from sqlalchemy import Column, Integer, String, Text, SmallInteger, TIMESTAMP
|
||
from ..database import Base
|
||
|
||
|
||
class App(Base):
|
||
"""应用定义表 - 定义可供租户使用的应用"""
|
||
__tablename__ = "platform_apps"
|
||
|
||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||
app_code = Column(String(50), nullable=False, unique=True) # 唯一标识,如 tools
|
||
app_name = Column(String(100), nullable=False) # 显示名称
|
||
base_url = Column(String(500)) # 基础URL,如 https://tools.test.ai.ireborn.com.cn
|
||
description = Column(Text) # 应用描述
|
||
|
||
# 应用下的工具/功能列表(JSON 数组)
|
||
# [{"code": "brainstorm", "name": "头脑风暴", "path": "/brainstorm"}, ...]
|
||
tools = Column(Text)
|
||
|
||
# 配置项定义(JSON 数组)- 定义租户可配置的参数
|
||
# [{"key": "industry", "label": "行业类型", "type": "radio", "options": [...], "default": "...", "required": false}, ...]
|
||
# type: text(文本) | radio(单选) | select(下拉多选) | switch(开关)
|
||
config_schema = Column(Text)
|
||
|
||
# 是否需要企微JS-SDK
|
||
require_jssdk = Column(SmallInteger, default=0) # 0-不需要 1-需要
|
||
|
||
status = Column(SmallInteger, default=1) # 0-禁用 1-启用
|
||
created_at = Column(TIMESTAMP, default=datetime.now)
|
||
updated_at = Column(TIMESTAMP, default=datetime.now, onupdate=datetime.now)
|