From e4a6ca15b9ae47457955c01a929d18caa1522351 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 24 Jun 2026 01:42:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8API=E6=94=AF=E6=8C=81*=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 api/get_customer_list.dspy,返回带*选项的客户列表 - json/discount_list.json: customerid 使用自定义 dataurl - load_path.py: 注册新API到logined和operator --- json/discount_list.json | 10 ++-------- scripts/load_path.py | 2 ++ wwwroot/api/get_customer_list.dspy | 11 +++++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 wwwroot/api/get_customer_list.dspy diff --git a/json/discount_list.json b/json/discount_list.json index fd174fa..d816f2e 100644 --- a/json/discount_list.json +++ b/json/discount_list.json @@ -14,14 +14,8 @@ "alters": { "customerid": { "uitype": "code", - "dataurl": "/appbase/get_code.dspy", - "datamethod": "GET", - "dataparams": { - "dbname": "sage", - "table": "organization", - "tblvalue": "id", - "tbltext": "orgname" - } + "dataurl": "{{entire_url('../api/get_customer_list.dspy')}}", + "datamethod": "GET" } } }, diff --git a/scripts/load_path.py b/scripts/load_path.py index 339c2af..8701a4d 100644 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -101,6 +101,7 @@ PATHS_LOGINED = [ f"/{MOD}/discount_customer_bind_list/update_discount_customer_bind.dspy", f"/{MOD}/discount_customer_bind_list/delete_discount_customer_bind.dspy", # CRUD API (json/ defined) + f"/{MOD}/api/get_customer_list.dspy", f"/{MOD}/api/discount_create.dspy", f"/{MOD}/api/discount_update.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_delete.dspy", # 折扣方案和明细 API + f"/{MOD}/api/get_customer_list.dspy", f"/{MOD}/api/discount_create.dspy", f"/{MOD}/api/discount_update.dspy", f"/{MOD}/api/discount_delete.dspy", diff --git a/wwwroot/api/get_customer_list.dspy b/wwwroot/api/get_customer_list.dspy new file mode 100644 index 0000000..e422932 --- /dev/null +++ b/wwwroot/api/get_customer_list.dspy @@ -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