diff --git a/init/data.json b/init/data.json index 04b8e85..d29845c 100644 --- a/init/data.json +++ b/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/models/pipeline_capacity.json b/models/pipeline_capacity.json index d5ba9a9..d69a7af 100644 --- a/models/pipeline_capacity.json +++ b/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/models/pipeline_pricing.json b/models/pipeline_pricing.json index 88b4f8a..812cdae 100644 --- a/models/pipeline_pricing.json +++ b/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/models/pipeline_usage_log.json b/models/pipeline_usage_log.json index 20efb04..1920af7 100644 --- a/models/pipeline_usage_log.json +++ b/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'" + } ] }