refactor: resellerid → auto from get_userorgid(), remove from codes

This commit is contained in:
yumoqing 2026-07-09 13:39:10 +08:00
parent de1e873d91
commit 6c8d23b986
14 changed files with 1834 additions and 779 deletions

View File

@ -49,7 +49,7 @@ async def discount_qrcode(request, params_kw):
async def set_promote_discount(request, params_kw): async def set_promote_discount(request, params_kw):
env = ServerEnv() env = request._run_ns
dbname = env.get_module_dbname('discount') dbname = env.get_module_dbname('discount')
config = getConfig() config = getConfig()
db = DBPools() db = DBPools()

1022
discount/init.py.bak Normal file

File diff suppressed because it is too large Load Diff

11
discount/init.py.new Normal file
View File

@ -0,0 +1,11 @@
import asyncio, json, os, re, traceback, uuid
from datetime import datetime, timedelta
import yaml
from appPublic.log import exception, debug, info, critical
from appPublic.Singleton import SingletonDecorator
from appPublic.uniqueID import getID
from appPublic.dictObject import DictObject
from appPublic.jsonConfig import getConfig
from appPublic.timeUtils import timestampstr
from sqlor.dbpools import DBPools, get_sor_context
from ahserver.serverenv import ServerEnv

View File

@ -1,34 +1,34 @@
{ {
"tblname": "discount_customer_bind", "tblname": "discount_customer_bind",
"alias": "discount_customer_bind_list", "alias": "discount_customer_bind_list",
"title": "客户归属", "title": "客户归属",
"params": { "params": {
"browserfields": { "browserfields": {
"sale_id": { "sale_id": {
"title": "归属销售", "title": "归属销售",
"width": 120 "width": 120
}, },
"promo_code_id": { "promo_code_id": {
"title": "促销码", "title": "促销码",
"width": 150 "width": 150
}, },
"bind_type": { "bind_type": {
"title": "绑定方式", "title": "绑定方式",
"width": 100 "width": 100
}, },
"created_at": { "created_at": {
"title": "绑定时间", "title": "绑定时间",
"width": 160 "width": 160
} }
}, },
"editexclouded": [ "editexclouded": [
"customerid", "customerid",
"resellerid" "resellerid"
], ],
"editable": { "editable": {
"new_data_url": "{{entire_url('../api/customer_bind_create.dspy')}}", "new_data_url": "{{entire_url('../api/customer_bind_create.dspy')}}",
"update_data_url": "{{entire_url('../api/customer_bind_update.dspy')}}", "update_data_url": "{{entire_url('../api/customer_bind_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/customer_bind_delete.dspy')}}" "delete_data_url": "{{entire_url('../api/customer_bind_delete.dspy')}}"
} }
} }
} }

View File

@ -1,40 +1,40 @@
{ {
"tblname": "discount", "tblname": "discount",
"alias": "discount_list", "alias": "discount_list",
"title": "折扣管理", "title": "折扣管理",
"params": { "params": {
"sortby": [ "sortby": [
"enabled_date desc" "enabled_date desc"
], ],
"browserfields": { "browserfields": {
"exclouded": [ "exclouded": [
"id", "id",
"resellerid" "resellerid"
], ],
"alters": { "alters": {
"customerid": { "customerid": {
"uitype": "code", "uitype": "code",
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}", "dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
"datamethod": "GET" "datamethod": "GET"
} }
} }
}, },
"editexclouded": [ "editexclouded": [
"id", "id",
"resellerid" "resellerid"
], ],
"editable": { "editable": {
"new_data_url": "{{entire_url('../api/discount_create.dspy')}}", "new_data_url": "{{entire_url('../api/discount_create.dspy')}}",
"update_data_url": "{{entire_url('../api/discount_update.dspy')}}", "update_data_url": "{{entire_url('../api/discount_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}" "delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}"
}, },
"logined_userorgid": "resellerid", "logined_userorgid": "resellerid",
"subtables": [ "subtables": [
{ {
"field": "discountid", "field": "discountid",
"title": "设置产品折扣", "title": "设置产品折扣",
"subtable": "discount_setting" "subtable": "discount_setting"
} }
] ]
} }
} }

View File

@ -1,64 +1,64 @@
{ {
"tblname": "discount_marketing", "tblname": "discount_marketing",
"alias": "discount_marketing_list", "alias": "discount_marketing_list",
"title": "营销方案", "title": "营销方案",
"params": { "params": {
"browserfields": { "browserfields": {
"name": { "name": {
"title": "方案名称" "title": "方案名称"
}, },
"enabled_date": { "enabled_date": {
"title": "启用日期", "title": "启用日期",
"width": 120 "width": 120
}, },
"expired_date": { "expired_date": {
"title": "失效日期", "title": "失效日期",
"width": 120 "width": 120
}, },
"status": { "status": {
"title": "状态", "title": "状态",
"width": 80 "width": 80
} }
}, },
"editexclouded": [ "editexclouded": [
"id", "id",
"resellerid", "resellerid",
"created_by", "created_by",
"created_at", "created_at",
"updated_at" "updated_at"
], ],
"toolbar": { "toolbar": {
"tools": [ "tools": [
{ {
"name": "detail", "name": "detail",
"selected_row": true, "selected_row": true,
"label": "产品明细", "label": "产品明细",
"icon": "{{entire_url('/bricks/imgs/list.svg')}}" "icon": "{{entire_url('/bricks/imgs/list.svg')}}"
} }
] ]
}, },
"binds": [ "binds": [
{ {
"wid": "self", "wid": "self",
"event": "detail", "event": "detail",
"actiontype": "urlwidget", "actiontype": "urlwidget",
"target": "app.sage_main_content", "target": "app.sage_main_content",
"params_mapping": { "params_mapping": {
"mapping": { "mapping": {
"id": "discountid" "id": "discountid"
}, },
"need_other": false "need_other": false
}, },
"options": { "options": {
"url": "{{entire_url('../marketing_discount_setting')}}" "url": "{{entire_url('../marketing_discount_setting')}}"
} }
} }
], ],
"editable": { "editable": {
"new_data_url": "{{entire_url('../api/marketing_create.dspy')}}", "new_data_url": "{{entire_url('../api/marketing_create.dspy')}}",
"update_data_url": "{{entire_url('../api/marketing_update.dspy')}}", "update_data_url": "{{entire_url('../api/marketing_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/marketing_delete.dspy')}}" "delete_data_url": "{{entire_url('../api/marketing_delete.dspy')}}"
}, },
"logined_userorgid": "resellerid" "logined_userorgid": "resellerid"
} }
} }

View File

@ -1,63 +1,65 @@
{ {
"tblname": "discount_promo_code", "tblname": "discount_promo_code",
"alias": "discount_promo_code_list", "alias": "discount_promo_code_list",
"title": "促销码", "title": "促销码",
"params": { "params": {
"browserfields": { "browserfields": {
"exclouded": ["id"], "exclouded": [
"marketing_id": { "id"
"title": "营销方案", ],
"width": 150 "marketing_id": {
}, "title": "营销方案",
"code_type": { "width": 150
"title": "类型", },
"width": 80 "code_type": {
}, "title": "类型",
"status": { "width": 80
"title": "状态", },
"width": 80 "status": {
}, "title": "状态",
"created_at": { "width": 80
"title": "生成时间", },
"width": 160 "created_at": {
} "title": "生成时间",
}, "width": 160
"editexclouded": [ }
"id", },
"resellerid", "editexclouded": [
"sale_id", "id",
"created_at" "resellerid",
], "sale_id",
"toolbar": { "created_at"
"tools": [ ],
{ "toolbar": {
"name": "generate_qr", "tools": [
"label": "生成二维码", {
"selected_row": true "name": "generate_qr",
} "label": "生成二维码",
] "selected_row": true
}, }
"binds": [ ]
{ },
"wid": "self", "binds": [
"event": "generate_qr", {
"actiontype": "urlwidget", "wid": "self",
"target": "PopupWindow", "event": "generate_qr",
"popup_options": { "actiontype": "urlwidget",
"title": "促销码二维码", "target": "PopupWindow",
"cwidth": 18, "popup_options": {
"cheight": 22 "title": "促销码二维码",
}, "cwidth": 18,
"options": { "cheight": 22
"url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$" },
} "options": {
} "url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$"
], }
"editable": { }
"new_data_url": "{{entire_url('../api/promo_code_create.dspy')}}", ],
"update_data_url": "{{entire_url('../api/promo_code_update.dspy')}}", "editable": {
"delete_data_url": "{{entire_url('../api/promo_code_delete.dspy')}}" "new_data_url": "{{entire_url('../api/promo_code_create.dspy')}}",
}, "update_data_url": "{{entire_url('../api/promo_code_update.dspy')}}",
"logined_userorgid": "resellerid" "delete_data_url": "{{entire_url('../api/promo_code_delete.dspy')}}"
} },
} "logined_userorgid": "resellerid"
}
}

View File

@ -1,26 +1,39 @@
{ {
"tblname": "reseller_discount_tier", "tblname": "reseller_discount_tier",
"title": "阶梯折扣管理", "title": "阶梯折扣管理",
"params": { "params": {
"sortby": "sort_order asc", "sortby": "sort_order asc",
"logined_userorgid": "resellerid", "logined_userorgid": "resellerid",
"browserfields": { "browserfields": {
"exclouded": ["id"], "exclouded": [
"alters": { "id"
"status": { ],
"uitype": "code", "alters": {
"data": [ "status": {
{"value": "active", "text": "启用"}, "uitype": "code",
{"value": "inactive", "text": "停用"} "data": [
] {
} "value": "active",
} "text": "启用"
}, },
"editexclouded": ["id", "created_at", "updated_at"], {
"editable": { "value": "inactive",
"new_data_url": "{{entire_url('../api/reseller_discount_tier_create.dspy')}}", "text": "停用"
"update_data_url": "{{entire_url('../api/reseller_discount_tier_update.dspy')}}", }
"delete_data_url": "{{entire_url('../api/reseller_discount_tier_delete.dspy')}}" ]
} }
} }
} },
"editexclouded": [
"id",
"created_at",
"updated_at",
"resellerid"
],
"editable": {
"new_data_url": "{{entire_url('../api/reseller_discount_tier_create.dspy')}}",
"update_data_url": "{{entire_url('../api/reseller_discount_tier_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/reseller_discount_tier_delete.dspy')}}"
}
}
}

View File

@ -1,62 +1,58 @@
{ {
"summary": [ "summary": [
{ {
"name": "discount", "name": "discount",
"title": "折扣表", "title": "折扣表",
"primary": ["id"], "primary": [
"catelog": "entity" "id"
} ],
], "catelog": "entity"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "id", {
"type": "str", "name": "id",
"length": 32 "title": "id",
}, "type": "str",
{ "length": 32
"name": "name", },
"title": "折扣名称", {
"type": "str", "name": "name",
"length": 100 "title": "折扣名称",
}, "type": "str",
{ "length": 100
"name": "resellerid", },
"title": "商户id", {
"type": "str", "name": "resellerid",
"length": 32, "title": "商户id",
"default": "*" "type": "str",
}, "length": 32,
{ "default": "*"
"name": "customerid", },
"title": "客户id(*表示全部客户)", {
"type": "str", "name": "customerid",
"length": 32, "title": "客户id(*表示全部客户)",
"default": "*" "type": "str",
}, "length": 32,
{ "default": "*"
"name": "enabled_date", },
"title": "启用日期", {
"type": "date" "name": "enabled_date",
}, "title": "启用日期",
{ "type": "date"
"name": "expired_date", },
"title": "失效日期", {
"type": "date" "name": "expired_date",
} "title": "失效日期",
], "type": "date"
"codes": [ }
{ ],
"field": "resellerid", "codes": [
"table": "organization", {
"valuefield": "id", "field": "customerid",
"textfield": "orgname" "table": "organization",
}, "valuefield": "id",
{ "textfield": "orgname"
"field": "customerid", }
"table": "organization", ]
"valuefield": "id", }
"textfield": "orgname"
}
]
}

View File

@ -1,97 +1,102 @@
{ {
"summary": [ "summary": [
{ {
"name": "discount_customer_bind", "name": "discount_customer_bind",
"title": "客户归属关系", "title": "客户归属关系",
"primary": ["id"], "primary": [
"catelog": "relation" "id"
} ],
], "catelog": "relation"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "id", {
"type": "str", "name": "id",
"length": 32, "title": "id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "customerid", },
"title": "客户用户id", {
"type": "str", "name": "customerid",
"length": 32, "title": "客户用户id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "resellerid", },
"title": "归属分销商机构id", {
"type": "str", "name": "resellerid",
"length": 32, "title": "归属分销商机构id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "sale_id", },
"title": "归属销售用户id", {
"type": "str", "name": "sale_id",
"length": 32, "title": "归属销售用户id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "promo_code_id", },
"title": "促销码id(空=非促销码方式)", {
"type": "str", "name": "promo_code_id",
"length": 32 "title": "促销码id(空=非促销码方式)",
}, "type": "str",
{ "length": 32
"name": "bind_type", },
"title": "绑定方式(1=促销码 2=手动 3=域名注册)", {
"type": "char", "name": "bind_type",
"length": 1, "title": "绑定方式(1=促销码 2=手动 3=域名注册)",
"default": "1", "type": "char",
"nullable": "no" "length": 1,
}, "default": "1",
{ "nullable": "no"
"name": "created_at", },
"title": "绑定时间", {
"type": "timestamp", "name": "created_at",
"nullable": "no" "title": "绑定时间",
} "type": "timestamp",
], "nullable": "no"
"indexes": [ }
{ ],
"name": "idx_dcb_customer_reseller", "indexes": [
"idxtype": "unique", {
"idxfields": ["customerid", "resellerid"] "name": "idx_dcb_customer_reseller",
}, "idxtype": "unique",
{ "idxfields": [
"name": "idx_dcb_reseller", "customerid",
"idxtype": "index", "resellerid"
"idxfields": ["resellerid"] ]
}, },
{ {
"name": "idx_dcb_sale", "name": "idx_dcb_reseller",
"idxtype": "index", "idxtype": "index",
"idxfields": ["sale_id"] "idxfields": [
}, "resellerid"
{ ]
"name": "idx_dcb_promo", },
"idxtype": "index", {
"idxfields": ["promo_code_id"] "name": "idx_dcb_sale",
} "idxtype": "index",
], "idxfields": [
"codes": [ "sale_id"
{ ]
"field": "resellerid", },
"table": "organization", {
"valuefield": "id", "name": "idx_dcb_promo",
"textfield": "orgname" "idxtype": "index",
}, "idxfields": [
{ "promo_code_id"
"field": "bind_type", ]
"table": "appcodes_kv", }
"valuefield": "k", ],
"textfield": "v", "codes": [
"cond": "parentid='bind_type'" {
} "field": "bind_type",
] "table": "appcodes_kv",
} "valuefield": "k",
"textfield": "v",
"cond": "parentid='bind_type'"
}
]
}

View File

@ -1,92 +1,94 @@
{ {
"summary": [ "summary": [
{ {
"name": "discount_detail", "name": "discount_detail",
"title": "折扣明细表", "title": "折扣明细表",
"primary": ["id"], "primary": [
"catelog": "entity" "id"
} ],
], "catelog": "entity"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "id", {
"type": "str", "name": "id",
"length": 32, "title": "id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "discountid", },
"title": "折扣方案id", {
"type": "str", "name": "discountid",
"length": 32, "title": "折扣方案id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "resellerid", },
"title": "商户id", {
"type": "str", "name": "resellerid",
"length": 32, "title": "商户id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "prodtypeid", },
"title": "产品种类id", {
"type": "str", "name": "prodtypeid",
"length": 32 "title": "产品种类id",
}, "type": "str",
{ "length": 32
"name": "productid", },
"title": "产品id", {
"type": "str", "name": "productid",
"length": 32 "title": "产品id",
}, "type": "str",
{ "length": 32
"name": "discount", },
"title": "折扣", {
"type": "double", "name": "discount",
"length": 5, "title": "折扣",
"dec": 4, "type": "double",
"nullable": "no" "length": 5,
} "dec": 4,
], "nullable": "no"
"indexes": [ }
{ ],
"name": "idx_dd_discountid", "indexes": [
"idxtype": "index", {
"idxfields": ["discountid"] "name": "idx_dd_discountid",
}, "idxtype": "index",
{ "idxfields": [
"name": "idx_dd_product", "discountid"
"idxtype": "index", ]
"idxfields": ["discountid", "prodtypeid", "productid"] },
} {
], "name": "idx_dd_product",
"codes": [ "idxtype": "index",
{ "idxfields": [
"field": "discountid", "discountid",
"table": "discount", "prodtypeid",
"valuefield": "id", "productid"
"textfield": "name" ]
}, }
{ ],
"field": "resellerid", "codes": [
"table": "organization", {
"valuefield": "id", "field": "discountid",
"textfield": "orgname" "table": "discount",
}, "valuefield": "id",
{ "textfield": "name"
"field": "prodtypeid", },
"table": "product_category", {
"valuefield": "id", "field": "prodtypeid",
"textfield": "name" "table": "product_category",
}, "valuefield": "id",
{ "textfield": "name"
"field": "productid", },
"table": "product", {
"valuefield": "id", "field": "productid",
"textfield": "product_name", "table": "product",
"cond": "category_id=[[prodtypeid]]" "valuefield": "id",
} "textfield": "product_name",
] "cond": "category_id=[[prodtypeid]]"
} }
]
}

View File

@ -1,95 +1,95 @@
{ {
"summary": [ "summary": [
{ {
"name": "discount_marketing", "name": "discount_marketing",
"title": "营销方案", "title": "营销方案",
"primary": ["id"], "primary": [
"catelog": "entity" "id"
} ],
], "catelog": "entity"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "id", {
"type": "str", "name": "id",
"length": 32, "title": "id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "resellerid", },
"title": "商户机构id", {
"type": "str", "name": "resellerid",
"length": 32, "title": "商户机构id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "name", },
"title": "方案名称", {
"type": "str", "name": "name",
"length": 255, "title": "方案名称",
"nullable": "no" "type": "str",
}, "length": 255,
{ "nullable": "no"
"name": "enabled_date", },
"title": "启用日期", {
"type": "date" "name": "enabled_date",
}, "title": "启用日期",
{ "type": "date"
"name": "expired_date", },
"title": "失效日期", {
"type": "date" "name": "expired_date",
}, "title": "失效日期",
{ "type": "date"
"name": "status", },
"title": "状态", {
"type": "char", "name": "status",
"length": 1, "title": "状态",
"default": "1" "type": "char",
}, "length": 1,
{ "default": "1"
"name": "created_by", },
"title": "创建人", {
"type": "str", "name": "created_by",
"length": 32 "title": "创建人",
}, "type": "str",
{ "length": 32
"name": "created_at", },
"title": "创建时间", {
"type": "timestamp", "name": "created_at",
"nullable": "no" "title": "创建时间",
}, "type": "timestamp",
{ "nullable": "no"
"name": "updated_at", },
"title": "更新时间", {
"type": "timestamp", "name": "updated_at",
"nullable": "no" "title": "更新时间",
} "type": "timestamp",
], "nullable": "no"
"indexes": [ }
{ ],
"name": "idx_dm_reseller", "indexes": [
"idxtype": "index", {
"idxfields": ["resellerid"] "name": "idx_dm_reseller",
}, "idxtype": "index",
{ "idxfields": [
"name": "idx_dm_status", "resellerid"
"idxtype": "index", ]
"idxfields": ["status"] },
} {
], "name": "idx_dm_status",
"codes": [ "idxtype": "index",
{ "idxfields": [
"field": "resellerid", "status"
"table": "organization", ]
"valuefield": "id", }
"textfield": "orgname" ],
}, "codes": [
{ {
"field": "status", "field": "status",
"table": "appcodes_kv", "table": "appcodes_kv",
"valuefield": "k", "valuefield": "k",
"textfield": "v", "textfield": "v",
"cond": "parentid='product_status'" "cond": "parentid='product_status'"
} }
] ]
} }

View File

@ -1,104 +1,106 @@
{ {
"summary": [ "summary": [
{ {
"name": "discount_promo_code", "name": "discount_promo_code",
"title": "促销码", "title": "促销码",
"primary": ["id"], "primary": [
"catelog": "entity" "id"
} ],
], "catelog": "entity"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "促销码(即id本身)", {
"type": "str", "name": "id",
"length": 32, "title": "促销码(即id本身)",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "marketing_id", },
"title": "营销方案id(可空=纯邀请码)", {
"type": "str", "name": "marketing_id",
"length": 32 "title": "营销方案id(可空=纯邀请码)",
}, "type": "str",
{ "length": 32
"name": "resellerid", },
"title": "所属商户机构id", {
"type": "str", "name": "resellerid",
"length": 32, "title": "所属商户机构id",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "sale_id", },
"title": "生成销售id", {
"type": "str", "name": "sale_id",
"length": 32 "title": "生成销售id",
}, "type": "str",
{ "length": 32
"name": "code_type", },
"title": "码类型(1=促销码 2=邀请码)", {
"type": "char", "name": "code_type",
"length": 1, "title": "码类型(1=促销码 2=邀请码)",
"default": "1", "type": "char",
"nullable": "no" "length": 1,
}, "default": "1",
{ "nullable": "no"
"name": "status", },
"title": "状态", {
"type": "char", "name": "status",
"length": 1, "title": "状态",
"default": "1" "type": "char",
}, "length": 1,
{ "default": "1"
"name": "created_at", },
"title": "生成时间", {
"type": "timestamp", "name": "created_at",
"nullable": "no" "title": "生成时间",
} "type": "timestamp",
], "nullable": "no"
"indexes": [ }
{ ],
"name": "idx_dpc_reseller", "indexes": [
"idxtype": "index", {
"idxfields": ["resellerid"] "name": "idx_dpc_reseller",
}, "idxtype": "index",
{ "idxfields": [
"name": "idx_dpc_sale", "resellerid"
"idxtype": "index", ]
"idxfields": ["sale_id"] },
}, {
{ "name": "idx_dpc_sale",
"name": "idx_dpc_marketing", "idxtype": "index",
"idxtype": "index", "idxfields": [
"idxfields": ["marketing_id"] "sale_id"
} ]
], },
"codes": [ {
{ "name": "idx_dpc_marketing",
"field": "resellerid", "idxtype": "index",
"table": "organization", "idxfields": [
"valuefield": "id", "marketing_id"
"textfield": "orgname" ]
}, }
{ ],
"field": "marketing_id", "codes": [
"table": "discount_marketing", {
"valuefield": "id", "field": "marketing_id",
"textfield": "name" "table": "discount_marketing",
}, "valuefield": "id",
{ "textfield": "name"
"field": "code_type", },
"table": "appcodes_kv", {
"valuefield": "k", "field": "code_type",
"textfield": "v", "table": "appcodes_kv",
"cond": "parentid='promo_code_type'" "valuefield": "k",
}, "textfield": "v",
{ "cond": "parentid='promo_code_type'"
"field": "status", },
"table": "appcodes_kv", {
"valuefield": "k", "field": "status",
"textfield": "v", "table": "appcodes_kv",
"cond": "parentid='product_status'" "valuefield": "k",
} "textfield": "v",
] "cond": "parentid='product_status'"
} }
]
}

View File

@ -1,113 +1,115 @@
{ {
"summary": [ "summary": [
{ {
"name": "reseller_discount_tier", "name": "reseller_discount_tier",
"title": "分销商阶梯折扣", "title": "分销商阶梯折扣",
"primary": ["id"], "primary": [
"catelog": "entity" "id"
} ],
], "catelog": "entity"
"fields": [ }
{ ],
"name": "id", "fields": [
"title": "主键ID", {
"type": "str", "name": "id",
"length": 32, "title": "主键ID",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "resellerid", },
"title": "分销商机构ID", {
"type": "str", "name": "resellerid",
"length": 32, "title": "分销商机构ID",
"nullable": "no" "type": "str",
}, "length": 32,
{ "nullable": "no"
"name": "name", },
"title": "档位名称", {
"type": "str", "name": "name",
"length": 50, "title": "档位名称",
"nullable": "no" "type": "str",
}, "length": 50,
{ "nullable": "no"
"name": "min_amount", },
"title": "最低消费金额", {
"type": "float", "name": "min_amount",
"length": 18, "title": "最低消费金额",
"dec": 2, "type": "float",
"nullable": "no", "length": 18,
"default": "0.00" "dec": 2,
}, "nullable": "no",
{ "default": "0.00"
"name": "max_amount", },
"title": "最高消费金额(NULL=无上限)", {
"type": "float", "name": "max_amount",
"length": 18, "title": "最高消费金额(NULL=无上限)",
"dec": 2, "type": "float",
"nullable": "yes" "length": 18,
}, "dec": 2,
{ "nullable": "yes"
"name": "discount_pct", },
"title": "折扣百分比", {
"type": "float", "name": "discount_pct",
"length": 5, "title": "折扣百分比",
"dec": 2, "type": "float",
"nullable": "no" "length": 5,
}, "dec": 2,
{ "nullable": "no"
"name": "sort_order", },
"title": "排序", {
"type": "int", "name": "sort_order",
"length": 4, "title": "排序",
"nullable": "no", "type": "int",
"default": "0" "length": 4,
}, "nullable": "no",
{ "default": "0"
"name": "status", },
"title": "状态", {
"type": "str", "name": "status",
"length": 10, "title": "状态",
"nullable": "no", "type": "str",
"default": "active" "length": 10,
}, "nullable": "no",
{ "default": "active"
"name": "created_at", },
"title": "创建时间", {
"type": "timestamp", "name": "created_at",
"nullable": "no" "title": "创建时间",
}, "type": "timestamp",
{ "nullable": "no"
"name": "updated_at", },
"title": "更新时间", {
"type": "timestamp", "name": "updated_at",
"nullable": "no" "title": "更新时间",
} "type": "timestamp",
], "nullable": "no"
"indexes": [ }
{ ],
"name": "idx_rdt_reseller_order", "indexes": [
"idxtype": "index", {
"idxfields": ["resellerid", "sort_order"] "name": "idx_rdt_reseller_order",
}, "idxtype": "index",
{ "idxfields": [
"name": "idx_rdt_amount", "resellerid",
"idxtype": "index", "sort_order"
"idxfields": ["resellerid", "min_amount"] ]
} },
], {
"codes": [ "name": "idx_rdt_amount",
{ "idxtype": "index",
"field": "resellerid", "idxfields": [
"table": "organization", "resellerid",
"valuefield": "id", "min_amount"
"textfield": "orgname" ]
}, }
{ ],
"field": "status", "codes": [
"table": "appcodes_kv", {
"valuefield": "k", "field": "status",
"textfield": "v", "table": "appcodes_kv",
"cond": "parentid='discount_tier_status'" "valuefield": "k",
} "textfield": "v",
] "cond": "parentid='discount_tier_status'"
} }
]
}