fix: init/data.json格式修正+model codes补全

pipeline-core:
- pipelines.json codes cond: id -> parentid

pipeline-ops:
- init/data.json: 转为Format B(parentid/parentname/items)
- pipeline_pricing.json: +4 codes(pricing_type/currency/status/pipeline_id)
- pipeline_capacity.json: +2 codes(capacity_status/pipeline_id)
- pipeline_usage_log.json: +2 codes(usage_status/pipeline_id)

pipeline-dist:
- init/data.json: 转为Format B(parentid/parentname/items)
- distributors.json: +1 code(distributor_status)
- distributor_pipeline.json: +4 codes(markup_type/dp_status/外键)
This commit is contained in:
yumoqing 2026-06-11 15:11:02 +08:00
parent 279266a12e
commit 707b491345
8 changed files with 661 additions and 120 deletions

View File

@ -113,14 +113,14 @@
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "id='pipeline_type'"
"cond": "parentid='pipeline_type'"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "id='pipeline_status'"
"cond": "parentid='pipeline_status'"
}
]
}

View File

@ -1,11 +1,29 @@
{
"distributor_status": {
"active": "活跃",
"suspended": "暂停",
"terminated": "终止"
"appcodes": [
{
"parentid": "distributor_status",
"parentname": "分销商状态",
"items": [
{"k": "active", "v": "活跃"},
{"k": "suspended", "v": "暂停"},
{"k": "terminated", "v": "终止"}
]
},
"markup_type": {
"fixed": "固定加价",
"percentage": "百分比加价"
{
"parentid": "markup_type",
"parentname": "加价方式",
"items": [
{"k": "fixed", "v": "固定加价"},
{"k": "percentage", "v": "百分比加价"}
]
},
{
"parentid": "dp_status",
"parentname": "分销产线状态",
"items": [
{"k": "enabled", "v": "已启用"},
{"k": "disabled", "v": "已停用"}
]
}
]
}

View File

@ -1,26 +1,140 @@
{
"summary": [{"name": "distributor_pipeline", "title": "分销商-产线关联定价表", "primary": ["id"]}],
"fields": [
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
{"name": "distributor_id", "title": "分销商ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "pipeline_id", "title": "产线ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "custom_price", "title": "自定义单价", "type": "double", "length": 15, "dec": 4},
{"name": "markup_type", "title": "加价方式", "type": "str", "length": 20},
{"name": "markup_value", "title": "加价值", "type": "double", "length": 10, "dec": 2},
{"name": "daily_limit", "title": "日限额", "type": "int", "default": "0"},
{"name": "monthly_limit", "title": "月限额", "type": "int", "default": "0"},
{"name": "today_usage", "title": "今日已用", "type": "int", "default": "0"},
{"name": "month_usage", "title": "本月已用", "type": "int", "default": "0"},
{"name": "status", "title": "状态", "type": "str", "length": 20, "default": "active"},
{"name": "created_at", "title": "创建时间", "type": "timestamp"},
{"name": "updated_at", "title": "更新时间", "type": "timestamp"}
],
"indexes": [
{"name": "idx_dp_dist_pipe", "idxtype": "unique", "idxfields": ["distributor_id", "pipeline_id"]},
{"name": "idx_dp_distributor", "idxtype": "index", "idxfields": ["distributor_id"]}
],
"codes": [
{"field": "distributor_id", "table": "distributors", "valuefield": "id", "textfield": "name"},
{"field": "pipeline_id", "table": "pipelines", "valuefield": "id", "textfield": "name"}
"summary": [
{
"name": "distributor_pipeline",
"title": "分销商-产线关联定价表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "主键",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "distributor_id",
"title": "分销商ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "pipeline_id",
"title": "产线ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "custom_price",
"title": "自定义单价",
"type": "double",
"length": 15,
"dec": 4
},
{
"name": "markup_type",
"title": "加价方式",
"type": "str",
"length": 20
},
{
"name": "markup_value",
"title": "加价值",
"type": "double",
"length": 10,
"dec": 2
},
{
"name": "daily_limit",
"title": "日限额",
"type": "int",
"default": "0"
},
{
"name": "monthly_limit",
"title": "月限额",
"type": "int",
"default": "0"
},
{
"name": "today_usage",
"title": "今日已用",
"type": "int",
"default": "0"
},
{
"name": "month_usage",
"title": "本月已用",
"type": "int",
"default": "0"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 20,
"default": "active"
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp"
}
],
"indexes": [
{
"name": "idx_dp_dist_pipe",
"idxtype": "unique",
"idxfields": [
"distributor_id",
"pipeline_id"
]
},
{
"name": "idx_dp_distributor",
"idxtype": "index",
"idxfields": [
"distributor_id"
]
}
],
"codes": [
{
"field": "distributor_id",
"table": "distributors",
"valuefield": "id",
"textfield": "name"
},
{
"field": "pipeline_id",
"table": "pipelines",
"valuefield": "id",
"textfield": "name"
},
{
"field": "markup_type",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='markup_type'"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='dp_status'"
}
]
}

View File

@ -1,24 +1,128 @@
{
"summary": [{"name": "distributors", "title": "分销商表", "primary": ["id"]}],
"fields": [
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
{"name": "name", "title": "分销商名称", "type": "str", "length": 200, "nullable": "no"},
{"name": "org_id", "title": "关联组织ID", "type": "str", "length": 32},
{"name": "contact_name", "title": "联系人", "type": "str", "length": 50},
{"name": "contact_phone", "title": "联系电话", "type": "str", "length": 20},
{"name": "contact_email", "title": "联系邮箱", "type": "str", "length": 100},
{"name": "api_key", "title": "API密钥", "type": "str", "length": 200},
{"name": "commission_rate", "title": "佣金比例%", "type": "double", "length": 5, "dec": 2, "default": "0"},
{"name": "status", "title": "状态", "type": "str", "length": 20, "default": "active"},
{"name": "agreement_start", "title": "协议开始日", "type": "date"},
{"name": "agreement_end", "title": "协议结束日", "type": "date"},
{"name": "remarks", "title": "备注", "type": "text"},
{"name": "created_by", "title": "创建人", "type": "str", "length": 32},
{"name": "created_at", "title": "创建时间", "type": "timestamp"},
{"name": "updated_at", "title": "更新时间", "type": "timestamp"}
],
"indexes": [
{"name": "idx_dist_name", "idxtype": "index", "idxfields": ["name"]},
{"name": "idx_dist_status", "idxtype": "index", "idxfields": ["status"]}
"summary": [
{
"name": "distributors",
"title": "分销商表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "主键",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "name",
"title": "分销商名称",
"type": "str",
"length": 200,
"nullable": "no"
},
{
"name": "org_id",
"title": "关联组织ID",
"type": "str",
"length": 32
},
{
"name": "contact_name",
"title": "联系人",
"type": "str",
"length": 50
},
{
"name": "contact_phone",
"title": "联系电话",
"type": "str",
"length": 20
},
{
"name": "contact_email",
"title": "联系邮箱",
"type": "str",
"length": 100
},
{
"name": "api_key",
"title": "API密钥",
"type": "str",
"length": 200
},
{
"name": "commission_rate",
"title": "佣金比例%",
"type": "double",
"length": 5,
"dec": 2,
"default": "0"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 20,
"default": "active"
},
{
"name": "agreement_start",
"title": "协议开始日",
"type": "date"
},
{
"name": "agreement_end",
"title": "协议结束日",
"type": "date"
},
{
"name": "remarks",
"title": "备注",
"type": "text"
},
{
"name": "created_by",
"title": "创建人",
"type": "str",
"length": 32
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp"
}
],
"indexes": [
{
"name": "idx_dist_name",
"idxtype": "index",
"idxfields": [
"name"
]
},
{
"name": "idx_dist_status",
"idxtype": "index",
"idxfields": [
"status"
]
}
],
"codes": [
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='distributor_status'"
}
]
}

View File

@ -1,28 +1,48 @@
{
"appcodes": {
"pricing_type": {
"per_call": "按次计费",
"per_token": "按Token计费",
"subscription": "订阅制"
"appcodes": [
{
"parentid": "pricing_type",
"parentname": "计费类型",
"items": [
{"k": "per_call", "v": "按次计费"},
{"k": "per_token", "v": "按Token计费"},
{"k": "subscription", "v": "订阅制"}
]
},
"pricing_status": {
"active": "生效中",
"expired": "已过期",
"pending": "待生效"
{
"parentid": "pricing_status",
"parentname": "定价状态",
"items": [
{"k": "active", "v": "生效中"},
{"k": "expired", "v": "已过期"},
{"k": "pending", "v": "待生效"}
]
},
"capacity_status": {
"active": "正常",
"paused": "已暂停",
"exhausted": "已耗尽"
{
"parentid": "capacity_status",
"parentname": "供应量状态",
"items": [
{"k": "active", "v": "正常"},
{"k": "paused", "v": "已暂停"},
{"k": "exhausted", "v": "已耗尽"}
]
},
"usage_status": {
"success": "成功",
"failed": "失败",
"timeout": "超时"
{
"parentid": "usage_status",
"parentname": "使用状态",
"items": [
{"k": "success", "v": "成功"},
{"k": "failed", "v": "失败"},
{"k": "timeout", "v": "超时"}
]
},
"currency": {
"CNY": "人民币",
"USD": "美元"
}
{
"parentid": "currency",
"parentname": "货币类型",
"items": [
{"k": "CNY", "v": "人民币"},
{"k": "USD", "v": "美元"}
]
}
]
}

View File

@ -1,21 +1,95 @@
{
"summary": [{"name": "pipeline_capacity", "title": "产线容量表", "primary": ["id"]}],
"fields": [
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
{"name": "pipeline_id", "title": "产线ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "max_concurrent", "title": "最大并发数", "type": "int"},
{"name": "daily_limit", "title": "每日限额", "type": "int"},
{"name": "monthly_limit", "title": "每月限额", "type": "int"},
{"name": "today_usage", "title": "今日用量", "type": "int"},
{"name": "month_usage", "title": "本月用量", "type": "int"},
{"name": "status", "title": "状态", "type": "str", "length": 20, "default": "active"},
{"name": "org_id", "title": "所属组织", "type": "str", "length": 32, "default": "0"},
{"name": "updated_at", "title": "更新时间", "type": "timestamp"}
],
"indexes": [
{"name": "uk_capacity_pipeline", "idxtype": "unique", "idxfields": ["pipeline_id"]}
],
"codes": [
{"field": "pipeline_id", "table": "pipelines", "valuefield": "id", "textfield": "name"}
"summary": [
{
"name": "pipeline_capacity",
"title": "产线容量表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "主键",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "pipeline_id",
"title": "产线ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "max_concurrent",
"title": "最大并发数",
"type": "int"
},
{
"name": "daily_limit",
"title": "每日限额",
"type": "int"
},
{
"name": "monthly_limit",
"title": "每月限额",
"type": "int"
},
{
"name": "today_usage",
"title": "今日用量",
"type": "int"
},
{
"name": "month_usage",
"title": "本月用量",
"type": "int"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 20,
"default": "active"
},
{
"name": "org_id",
"title": "所属组织",
"type": "str",
"length": 32,
"default": "0"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp"
}
],
"indexes": [
{
"name": "uk_capacity_pipeline",
"idxtype": "unique",
"idxfields": [
"pipeline_id"
]
}
],
"codes": [
{
"field": "pipeline_id",
"table": "pipelines",
"valuefield": "id",
"textfield": "name"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='capacity_status'"
}
]
}

View File

@ -1,25 +1,141 @@
{
"summary": [{"name": "pipeline_pricing", "title": "产线定价表", "primary": ["id"]}],
"fields": [
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
{"name": "pipeline_id", "title": "产线ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "pricing_type", "title": "计费方式", "type": "str", "length": 20, "nullable": "no"},
{"name": "unit_price", "title": "单价", "type": "double", "length": 15, "dec": 4, "nullable": "no", "default": "0"},
{"name": "currency", "title": "货币", "type": "str", "length": 10, "default": "CNY"},
{"name": "pricing_config", "title": "定价配置JSON", "type": "text"},
{"name": "effective_date", "title": "生效日期", "type": "date"},
{"name": "expiry_date", "title": "失效日期", "type": "date"},
{"name": "status", "title": "状态", "type": "str", "length": 20, "default": "active"},
{"name": "org_id", "title": "所属组织", "type": "str", "length": 32, "default": "0"},
{"name": "created_by", "title": "创建人", "type": "str", "length": 32},
{"name": "created_at", "title": "创建时间", "type": "timestamp"},
{"name": "updated_at", "title": "更新时间", "type": "timestamp"}
],
"indexes": [
{"name": "idx_pricing_pipeline", "idxtype": "index", "idxfields": ["pipeline_id"]},
{"name": "idx_pricing_status_date", "idxtype": "index", "idxfields": ["status", "effective_date"]}
],
"codes": [
{"field": "pipeline_id", "table": "pipelines", "valuefield": "id", "textfield": "name"}
"summary": [
{
"name": "pipeline_pricing",
"title": "产线定价表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "主键",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "pipeline_id",
"title": "产线ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "pricing_type",
"title": "计费方式",
"type": "str",
"length": 20,
"nullable": "no"
},
{
"name": "unit_price",
"title": "单价",
"type": "double",
"length": 15,
"dec": 4,
"nullable": "no",
"default": "0"
},
{
"name": "currency",
"title": "货币",
"type": "str",
"length": 10,
"default": "CNY"
},
{
"name": "pricing_config",
"title": "定价配置JSON",
"type": "text"
},
{
"name": "effective_date",
"title": "生效日期",
"type": "date"
},
{
"name": "expiry_date",
"title": "失效日期",
"type": "date"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 20,
"default": "active"
},
{
"name": "org_id",
"title": "所属组织",
"type": "str",
"length": 32,
"default": "0"
},
{
"name": "created_by",
"title": "创建人",
"type": "str",
"length": 32
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp"
}
],
"indexes": [
{
"name": "idx_pricing_pipeline",
"idxtype": "index",
"idxfields": [
"pipeline_id"
]
},
{
"name": "idx_pricing_status_date",
"idxtype": "index",
"idxfields": [
"status",
"effective_date"
]
}
],
"codes": [
{
"field": "pipeline_id",
"table": "pipelines",
"valuefield": "id",
"textfield": "name"
},
{
"field": "pricing_type",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='pricing_type'"
},
{
"field": "currency",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='currency'"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='pricing_status'"
}
]
}

View File

@ -1,24 +1,119 @@
{
"summary": [{"name": "pipeline_usage_log", "title": "产线调用日志表", "primary": ["id"]}],
"fields": [
{"name": "id", "title": "主键", "type": "str", "length": 32, "nullable": "no"},
{"name": "pipeline_id", "title": "产线ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "user_id", "title": "用户ID", "type": "str", "length": 32},
{"name": "distributor_id", "title": "分销商ID", "type": "str", "length": 32},
{"name": "call_count", "title": "调用次数", "type": "int", "default": "1"},
{"name": "token_input", "title": "输入Token数", "type": "int", "default": "0"},
{"name": "token_output", "title": "输出Token数", "type": "int", "default": "0"},
{"name": "amount", "title": "金额", "type": "double", "length": 15, "dec": 4, "default": "0"},
{"name": "status", "title": "状态", "type": "str", "length": 20},
{"name": "error_message", "title": "错误信息", "type": "text"},
{"name": "called_at", "title": "调用时间", "type": "timestamp"}
],
"indexes": [
{"name": "idx_usagelog_pipeline", "idxtype": "index", "idxfields": ["pipeline_id"]},
{"name": "idx_usagelog_called_at", "idxtype": "index", "idxfields": ["called_at"]},
{"name": "idx_usagelog_distributor", "idxtype": "index", "idxfields": ["distributor_id"]}
],
"codes": [
{"field": "pipeline_id", "table": "pipelines", "valuefield": "id", "textfield": "name"}
"summary": [
{
"name": "pipeline_usage_log",
"title": "产线调用日志表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "主键",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "pipeline_id",
"title": "产线ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "user_id",
"title": "用户ID",
"type": "str",
"length": 32
},
{
"name": "distributor_id",
"title": "分销商ID",
"type": "str",
"length": 32
},
{
"name": "call_count",
"title": "调用次数",
"type": "int",
"default": "1"
},
{
"name": "token_input",
"title": "输入Token数",
"type": "int",
"default": "0"
},
{
"name": "token_output",
"title": "输出Token数",
"type": "int",
"default": "0"
},
{
"name": "amount",
"title": "金额",
"type": "double",
"length": 15,
"dec": 4,
"default": "0"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 20
},
{
"name": "error_message",
"title": "错误信息",
"type": "text"
},
{
"name": "called_at",
"title": "调用时间",
"type": "timestamp"
}
],
"indexes": [
{
"name": "idx_usagelog_pipeline",
"idxtype": "index",
"idxfields": [
"pipeline_id"
]
},
{
"name": "idx_usagelog_called_at",
"idxtype": "index",
"idxfields": [
"called_at"
]
},
{
"name": "idx_usagelog_distributor",
"idxtype": "index",
"idxfields": [
"distributor_id"
]
}
],
"codes": [
{
"field": "pipeline_id",
"table": "pipelines",
"valuefield": "id",
"textfield": "name"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='usage_status'"
}
]
}