diff --git a/init/data.json b/init/data.json index b108a82..34a4c6a 100644 --- a/init/data.json +++ b/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/models/distributor_pipeline.json b/models/distributor_pipeline.json index 7c3443e..96f2245 100644 --- a/models/distributor_pipeline.json +++ b/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/models/distributors.json b/models/distributors.json index c69dbda..89e468e 100644 --- a/models/distributors.json +++ b/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'" + } ] }