product_management/models/product_subscription.json
Hermes Agent 24605f88e8 fix: datetime->timestamp for audit fields + fix sor.U/sor.I misuse in core.py and API dspy
- All 7 models: created_at/updated_at changed from datetime to timestamp type
  (DDL template auto-generates DEFAULT CURRENT_TIMESTAMP for timestamp type)
- core.py: fix all sor.U() calls passing 3 args (id must be in data dict)
- core.py: fix sor.I() misuse for INSERT (should be sor.C())
- API dspy updates: fix sor.U() 3-arg bug in category/product/type_config/resource/subscription/supplier
- product_resource_supplier_update.dspy: add missing updated_at field
2026-06-22 11:04:46 +08:00

213 lines
5.1 KiB
JSON

{
"summary": [
{
"name": "product_subscription",
"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": "user_id",
"title": "客户用户ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "user_org_id",
"title": "客户机构ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "subscription_type",
"title": "订购类型",
"type": "char",
"length": 1,
"nullable": "no"
},
{
"name": "status",
"title": "状态",
"type": "char",
"length": 1,
"nullable": "no",
"default": "1"
},
{
"name": "start_date",
"title": "生效日期",
"type": "date",
"nullable": "no"
},
{
"name": "end_date",
"title": "到期日期",
"type": "date",
"nullable": "no"
},
{
"name": "quota_total",
"title": "总配额",
"type": "double",
"length": 15,
"dec": 4,
"default": "0"
},
{
"name": "quota_used",
"title": "已使用量",
"type": "double",
"length": 15,
"dec": 4,
"default": "0"
},
{
"name": "quota_unit",
"title": "配额单位",
"type": "str",
"length": 32
},
{
"name": "overflow_mode",
"title": "超额模式",
"type": "char",
"length": 1,
"default": "1"
},
{
"name": "overflow_rate",
"title": "超额单价",
"type": "double",
"length": 15,
"dec": 6,
"default": "0"
},
{
"name": "purchase_price",
"title": "购买价格",
"type": "double",
"length": 15,
"dec": 2,
"default": "0"
},
{
"name": "purchase_currency",
"title": "货币",
"type": "char",
"length": 8,
"default": "CNY"
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp",
"nullable": "no"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "datetime"
}
],
"indexes": [
{
"name": "idx_ps_product",
"idxtype": "index",
"idxfields": [
"product_id"
]
},
{
"name": "idx_ps_user",
"idxtype": "index",
"idxfields": [
"user_id",
"user_org_id"
]
},
{
"name": "idx_ps_status",
"idxtype": "index",
"idxfields": [
"status"
]
},
{
"name": "idx_ps_dates",
"idxtype": "index",
"idxfields": [
"start_date",
"end_date"
]
}
],
"codes": [
{
"field": "product_id",
"table": "product",
"valuefield": "id",
"textfield": "product_name"
},
{
"field": "user_id",
"table": "sage.users",
"valuefield": "id",
"textfield": "username"
},
{
"field": "user_org_id",
"table": "sage.organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "subscription_type",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='subscription_type'"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='subscription_status'"
},
{
"field": "overflow_mode",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='overflow_mode'"
},
{
"field": "quota_unit",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='quota_unit'"
}
]
}