From b2691fe02add7b9dca2d864dc09edef53b9fff86 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 24 Jun 2026 12:59:14 +0800 Subject: [PATCH] fix: discount_detail_create get discountid from params/query/referer --- wwwroot/api/discount_detail_create.dspy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wwwroot/api/discount_detail_create.dspy b/wwwroot/api/discount_detail_create.dspy index 4aee793..809d5fc 100644 --- a/wwwroot/api/discount_detail_create.dspy +++ b/wwwroot/api/discount_detail_create.dspy @@ -7,6 +7,18 @@ try: data = dict(params_kw) data['id'] = uuid() data['resellerid'] = user_orgid + # discountid从多处获取(子表场景): params_kw > request.query > Referer头 + if not data.get('discountid'): + data['discountid'] = request.query.get('discountid', '') + if not data.get('discountid'): + referer = request.headers.get('Referer', '') + if 'discountid=' in referer: + for part in referer.split('?')[-1].split('&'): + if part.startswith('discountid='): + data['discountid'] = part.split('=', 1)[1] + break + if not data.get('discountid'): + raise Exception('discountid不能为空,请从折扣方案进入') async with DBPools().sqlorContext(dbname) as sor: await sor.C('discount_detail', data)