From 707b491345fe2706a4ed10fc426a6e2876a21244 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 11 Jun 2026 15:11:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20init/data.json=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3+model=20codes=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/外键) --- pipeline_core/models/pipelines.json | 6 +- pipeline_dist/init/data.json | 36 +++-- .../models/distributor_pipeline.json | 150 +++++++++++++++--- pipeline_dist/models/distributors.json | 140 +++++++++++++--- pipeline_ops/init/data.json | 72 ++++++--- pipeline_ops/models/pipeline_capacity.json | 100 ++++++++++-- pipeline_ops/models/pipeline_pricing.json | 150 ++++++++++++++++-- pipeline_ops/models/pipeline_usage_log.json | 127 +++++++++++++-- 8 files changed, 661 insertions(+), 120 deletions(-) diff --git a/pipeline_core/models/pipelines.json b/pipeline_core/models/pipelines.json index 5b6e24b..8c930eb 100644 --- a/pipeline_core/models/pipelines.json +++ b/pipeline_core/models/pipelines.json @@ -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'" } ] -} +} \ No newline at end of file diff --git a/pipeline_dist/init/data.json b/pipeline_dist/init/data.json index b108a82..34a4c6a 100644 --- a/pipeline_dist/init/data.json +++ b/pipeline_dist/init/data.json @@ -1,11 +1,29 @@ { - "distributor_status": { - "active": "活跃", - "suspended": "暂停", - "terminated": "终止" - }, - "markup_type": { - "fixed": "固定加价", - "percentage": "百分比加价" - } + "appcodes": [ + { + "parentid": "distributor_status", + "parentname": "分销商状态", + "items": [ + {"k": "active", "v": "活跃"}, + {"k": "suspended", "v": "暂停"}, + {"k": "terminated", "v": "终止"} + ] + }, + { + "parentid": "markup_type", + "parentname": "加价方式", + "items": [ + {"k": "fixed", "v": "固定加价"}, + {"k": "percentage", "v": "百分比加价"} + ] + }, + { + "parentid": "dp_status", + "parentname": "分销产线状态", + "items": [ + {"k": "enabled", "v": "已启用"}, + {"k": "disabled", "v": "已停用"} + ] + } + ] } diff --git a/pipeline_dist/models/distributor_pipeline.json b/pipeline_dist/models/distributor_pipeline.json index 7c3443e..96f2245 100644 --- a/pipeline_dist/models/distributor_pipeline.json +++ b/pipeline_dist/models/distributor_pipeline.json @@ -1,26 +1,140 @@ { - "summary": [{"name": "distributor_pipeline", "title": "分销商-产线关联定价表", "primary": ["id"]}], + "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"} + { + "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"]} + { + "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": "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'" + } ] } diff --git a/pipeline_dist/models/distributors.json b/pipeline_dist/models/distributors.json index c69dbda..89e468e 100644 --- a/pipeline_dist/models/distributors.json +++ b/pipeline_dist/models/distributors.json @@ -1,24 +1,128 @@ { - "summary": [{"name": "distributors", "title": "分销商表", "primary": ["id"]}], + "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"} + { + "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"]} + { + "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'" + } ] } diff --git a/pipeline_ops/init/data.json b/pipeline_ops/init/data.json index 04b8e85..d29845c 100644 --- a/pipeline_ops/init/data.json +++ b/pipeline_ops/init/data.json @@ -1,28 +1,48 @@ { - "appcodes": { - "pricing_type": { - "per_call": "按次计费", - "per_token": "按Token计费", - "subscription": "订阅制" - }, - "pricing_status": { - "active": "生效中", - "expired": "已过期", - "pending": "待生效" - }, - "capacity_status": { - "active": "正常", - "paused": "已暂停", - "exhausted": "已耗尽" - }, - "usage_status": { - "success": "成功", - "failed": "失败", - "timeout": "超时" - }, - "currency": { - "CNY": "人民币", - "USD": "美元" - } - } + "appcodes": [ + { + "parentid": "pricing_type", + "parentname": "计费类型", + "items": [ + {"k": "per_call", "v": "按次计费"}, + {"k": "per_token", "v": "按Token计费"}, + {"k": "subscription", "v": "订阅制"} + ] + }, + { + "parentid": "pricing_status", + "parentname": "定价状态", + "items": [ + {"k": "active", "v": "生效中"}, + {"k": "expired", "v": "已过期"}, + {"k": "pending", "v": "待生效"} + ] + }, + { + "parentid": "capacity_status", + "parentname": "供应量状态", + "items": [ + {"k": "active", "v": "正常"}, + {"k": "paused", "v": "已暂停"}, + {"k": "exhausted", "v": "已耗尽"} + ] + }, + { + "parentid": "usage_status", + "parentname": "使用状态", + "items": [ + {"k": "success", "v": "成功"}, + {"k": "failed", "v": "失败"}, + {"k": "timeout", "v": "超时"} + ] + }, + { + "parentid": "currency", + "parentname": "货币类型", + "items": [ + {"k": "CNY", "v": "人民币"}, + {"k": "USD", "v": "美元"} + ] + } + ] } diff --git a/pipeline_ops/models/pipeline_capacity.json b/pipeline_ops/models/pipeline_capacity.json index d5ba9a9..d69a7af 100644 --- a/pipeline_ops/models/pipeline_capacity.json +++ b/pipeline_ops/models/pipeline_capacity.json @@ -1,21 +1,95 @@ { - "summary": [{"name": "pipeline_capacity", "title": "产线容量表", "primary": ["id"]}], + "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"} + { + "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"]} + { + "name": "uk_capacity_pipeline", + "idxtype": "unique", + "idxfields": [ + "pipeline_id" + ] + } ], "codes": [ - {"field": "pipeline_id", "table": "pipelines", "valuefield": "id", "textfield": "name"} + { + "field": "pipeline_id", + "table": "pipelines", + "valuefield": "id", + "textfield": "name" + }, + { + "field": "status", + "table": "appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='capacity_status'" + } ] } diff --git a/pipeline_ops/models/pipeline_pricing.json b/pipeline_ops/models/pipeline_pricing.json index 88b4f8a..812cdae 100644 --- a/pipeline_ops/models/pipeline_pricing.json +++ b/pipeline_ops/models/pipeline_pricing.json @@ -1,25 +1,141 @@ { - "summary": [{"name": "pipeline_pricing", "title": "产线定价表", "primary": ["id"]}], + "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"} + { + "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"]} + { + "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": "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'" + } ] } diff --git a/pipeline_ops/models/pipeline_usage_log.json b/pipeline_ops/models/pipeline_usage_log.json index 20efb04..1920af7 100644 --- a/pipeline_ops/models/pipeline_usage_log.json +++ b/pipeline_ops/models/pipeline_usage_log.json @@ -1,24 +1,119 @@ { - "summary": [{"name": "pipeline_usage_log", "title": "产线调用日志表", "primary": ["id"]}], + "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"} + { + "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"]} + { + "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": "pipeline_id", + "table": "pipelines", + "valuefield": "id", + "textfield": "name" + }, + { + "field": "status", + "table": "appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='usage_status'" + } ] }