feat: 添加客户列表API支持*全部客户选项
- 新增 api/get_customer_list.dspy,返回带*选项的客户列表 - json/discount_list.json: customerid 使用自定义 dataurl - load_path.py: 注册新API到logined和operator
This commit is contained in:
parent
0fcc34c235
commit
e4a6ca15b9
@ -14,14 +14,8 @@
|
|||||||
"alters": {
|
"alters": {
|
||||||
"customerid": {
|
"customerid": {
|
||||||
"uitype": "code",
|
"uitype": "code",
|
||||||
"dataurl": "/appbase/get_code.dspy",
|
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
|
||||||
"datamethod": "GET",
|
"datamethod": "GET"
|
||||||
"dataparams": {
|
|
||||||
"dbname": "sage",
|
|
||||||
"table": "organization",
|
|
||||||
"tblvalue": "id",
|
|
||||||
"tbltext": "orgname"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -101,6 +101,7 @@ PATHS_LOGINED = [
|
|||||||
f"/{MOD}/discount_customer_bind_list/update_discount_customer_bind.dspy",
|
f"/{MOD}/discount_customer_bind_list/update_discount_customer_bind.dspy",
|
||||||
f"/{MOD}/discount_customer_bind_list/delete_discount_customer_bind.dspy",
|
f"/{MOD}/discount_customer_bind_list/delete_discount_customer_bind.dspy",
|
||||||
# CRUD API (json/ defined)
|
# CRUD API (json/ defined)
|
||||||
|
f"/{MOD}/api/get_customer_list.dspy",
|
||||||
f"/{MOD}/api/discount_create.dspy",
|
f"/{MOD}/api/discount_create.dspy",
|
||||||
f"/{MOD}/api/discount_update.dspy",
|
f"/{MOD}/api/discount_update.dspy",
|
||||||
f"/{MOD}/api/discount_delete.dspy",
|
f"/{MOD}/api/discount_delete.dspy",
|
||||||
@ -165,6 +166,7 @@ PATHS_OPERATOR = [
|
|||||||
f"/{MOD}/api/customer_bind_update.dspy",
|
f"/{MOD}/api/customer_bind_update.dspy",
|
||||||
f"/{MOD}/api/customer_bind_delete.dspy",
|
f"/{MOD}/api/customer_bind_delete.dspy",
|
||||||
# 折扣方案和明细 API
|
# 折扣方案和明细 API
|
||||||
|
f"/{MOD}/api/get_customer_list.dspy",
|
||||||
f"/{MOD}/api/discount_create.dspy",
|
f"/{MOD}/api/discount_create.dspy",
|
||||||
f"/{MOD}/api/discount_update.dspy",
|
f"/{MOD}/api/discount_update.dspy",
|
||||||
f"/{MOD}/api/discount_delete.dspy",
|
f"/{MOD}/api/discount_delete.dspy",
|
||||||
|
|||||||
11
wwwroot/api/get_customer_list.dspy
Normal file
11
wwwroot/api/get_customer_list.dspy
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 获取客户列表(带 * 全部客户选项)
|
||||||
|
db = DBPools()
|
||||||
|
sql = "select id as customerid, orgname as customerid_text from organization where 1=1 order by orgname"
|
||||||
|
|
||||||
|
rs = [{'customerid': '*', 'customerid_text': '全部客户'}]
|
||||||
|
|
||||||
|
async with db.sqlorContext('sage') as sor:
|
||||||
|
data = await sor.sqlExe(sql, {})
|
||||||
|
rs.extend(data)
|
||||||
|
|
||||||
|
return rs
|
||||||
Loading…
x
Reference in New Issue
Block a user