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):
env = ServerEnv()
env = request._run_ns
dbname = env.get_module_dbname('discount')
config = getConfig()
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

@ -4,7 +4,9 @@
"title": "促销码",
"params": {
"browserfields": {
"exclouded": ["id"],
"exclouded": [
"id"
],
"marketing_id": {
"title": "营销方案",
"width": 150

View File

@ -5,18 +5,31 @@
"sortby": "sort_order asc",
"logined_userorgid": "resellerid",
"browserfields": {
"exclouded": ["id"],
"exclouded": [
"id"
],
"alters": {
"status": {
"uitype": "code",
"data": [
{"value": "active", "text": "启用"},
{"value": "inactive", "text": "停用"}
{
"value": "active",
"text": "启用"
},
{
"value": "inactive",
"text": "停用"
}
]
}
}
},
"editexclouded": ["id", "created_at", "updated_at"],
"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')}}",

View File

@ -3,7 +3,9 @@
{
"name": "discount",
"title": "折扣表",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "entity"
}
],
@ -46,12 +48,6 @@
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "customerid",
"table": "organization",

View File

@ -3,7 +3,9 @@
{
"name": "discount_customer_bind",
"title": "客户归属关系",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "relation"
}
],
@ -61,31 +63,34 @@
{
"name": "idx_dcb_customer_reseller",
"idxtype": "unique",
"idxfields": ["customerid", "resellerid"]
"idxfields": [
"customerid",
"resellerid"
]
},
{
"name": "idx_dcb_reseller",
"idxtype": "index",
"idxfields": ["resellerid"]
"idxfields": [
"resellerid"
]
},
{
"name": "idx_dcb_sale",
"idxtype": "index",
"idxfields": ["sale_id"]
"idxfields": [
"sale_id"
]
},
{
"name": "idx_dcb_promo",
"idxtype": "index",
"idxfields": ["promo_code_id"]
"idxfields": [
"promo_code_id"
]
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "bind_type",
"table": "appcodes_kv",

View File

@ -3,7 +3,9 @@
{
"name": "discount_detail",
"title": "折扣明细表",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "entity"
}
],
@ -54,12 +56,18 @@
{
"name": "idx_dd_discountid",
"idxtype": "index",
"idxfields": ["discountid"]
"idxfields": [
"discountid"
]
},
{
"name": "idx_dd_product",
"idxtype": "index",
"idxfields": ["discountid", "prodtypeid", "productid"]
"idxfields": [
"discountid",
"prodtypeid",
"productid"
]
}
],
"codes": [
@ -69,12 +77,6 @@
"valuefield": "id",
"textfield": "name"
},
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "prodtypeid",
"table": "product_category",

View File

@ -3,7 +3,9 @@
{
"name": "discount_marketing",
"title": "营销方案",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "entity"
}
],
@ -69,21 +71,19 @@
{
"name": "idx_dm_reseller",
"idxtype": "index",
"idxfields": ["resellerid"]
"idxfields": [
"resellerid"
]
},
{
"name": "idx_dm_status",
"idxtype": "index",
"idxfields": ["status"]
"idxfields": [
"status"
]
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "status",
"table": "appcodes_kv",

View File

@ -3,7 +3,9 @@
{
"name": "discount_promo_code",
"title": "促销码",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "entity"
}
],
@ -60,26 +62,26 @@
{
"name": "idx_dpc_reseller",
"idxtype": "index",
"idxfields": ["resellerid"]
"idxfields": [
"resellerid"
]
},
{
"name": "idx_dpc_sale",
"idxtype": "index",
"idxfields": ["sale_id"]
"idxfields": [
"sale_id"
]
},
{
"name": "idx_dpc_marketing",
"idxtype": "index",
"idxfields": ["marketing_id"]
"idxfields": [
"marketing_id"
]
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "marketing_id",
"table": "discount_marketing",

View File

@ -3,7 +3,9 @@
{
"name": "reseller_discount_tier",
"title": "分销商阶梯折扣",
"primary": ["id"],
"primary": [
"id"
],
"catelog": "entity"
}
],
@ -87,21 +89,21 @@
{
"name": "idx_rdt_reseller_order",
"idxtype": "index",
"idxfields": ["resellerid", "sort_order"]
"idxfields": [
"resellerid",
"sort_order"
]
},
{
"name": "idx_rdt_amount",
"idxtype": "index",
"idxfields": ["resellerid", "min_amount"]
"idxfields": [
"resellerid",
"min_amount"
]
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "status",
"table": "appcodes_kv",