product_management/models/product_usage_log.json
Hermes Agent e8860401bc feat: 产品模块完整功能实现 — 资源绑定/多供应商路由/包月订购/消耗引擎/成本计算
新增模型: product_resource, product_resource_supplier, product_subscription, product_usage_log
新增API: 15个.dspy端点(资源绑定/供应商管理/订购/超额/消耗/统计)
新增UI: 4个管理界面(资源绑定/供应商关联/订购管理/消费记录)
核心逻辑: ProductManager新增 bind/unbind/subscribe/product_use/check_quota 等完整业务方法
设计文档: DESIGN.md 完整架构规范
2026-06-20 12:10:32 +08:00

68 lines
3.4 KiB
JSON

{
"summary": [
{
"name": "product_usage_log",
"title": "产品消费记录表",
"primary": ["id"],
"catelog": "relation"
}
],
"fields": [
{"name": "id", "title": "主键ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "product_id", "title": "产品ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "subscription_id", "title": "订购ID", "type": "str", "length": 32},
{"name": "user_id", "title": "消费者用户ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "user_org_id", "title": "消费者机构ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "product_resource_id", "title": "产品资源绑定ID", "type": "str", "length": 32},
{"name": "supplier_org_id", "title": "供应商机构ID", "type": "str", "length": 32},
{"name": "resource_type", "title": "资源类型", "type": "str", "length": 32},
{"name": "resource_ref_id", "title": "资源引用ID", "type": "str", "length": 32},
{"name": "used_amount", "title": "消耗量", "type": "double", "length": 15, "dec": 4, "nullable": "no"},
{"name": "used_unit", "title": "消耗单位", "type": "str", "length": 32},
{"name": "unit_cost", "title": "单位成本", "type": "double", "length": 15, "dec": 8, "default": "0"},
{"name": "total_cost", "title": "总成本", "type": "double", "length": 15, "dec": 6, "default": "0"},
{"name": "sell_price", "title": "客户售价", "type": "double", "length": 15, "dec": 6, "default": "0"},
{"name": "billing_mode", "title": "计费模式", "type": "char", "length": 1, "nullable": "no"},
{"name": "source_ref_table", "title": "来源表", "type": "str", "length": 64},
{"name": "source_ref_id", "title": "来源记录ID", "type": "str", "length": 32},
{"name": "use_time", "title": "消费时间", "type": "datetime", "nullable": "no"},
{"name": "created_at", "title": "创建时间", "type": "datetime", "nullable": "no"}
],
"indexes": [
{"name": "idx_pul_product", "idxtype": "index", "idxfields": ["product_id"]},
{"name": "idx_pul_subscription", "idxtype": "index", "idxfields": ["subscription_id"]},
{"name": "idx_pul_user", "idxtype": "index", "idxfields": ["user_id", "user_org_id"]},
{"name": "idx_pul_supplier", "idxtype": "index", "idxfields": ["supplier_org_id"]},
{"name": "idx_pul_time", "idxtype": "index", "idxfields": ["use_time"]},
{"name": "idx_pul_source", "idxtype": "index", "idxfields": ["source_ref_table", "source_ref_id"]}
],
"codes": [
{
"field": "product_id",
"table": "product",
"valuefield": "id",
"textfield": "product_name"
},
{
"field": "supplier_org_id",
"table": "supplychain.suppliers",
"valuefield": "org_id",
"textfield": "supplier_name"
},
{
"field": "resource_type",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='resource_type'"
},
{
"field": "billing_mode",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='billing_mode'"
}
]
}