fix: discount_detail_create get discountid from params/query/referer
This commit is contained in:
parent
f8c2347292
commit
b2691fe02a
@ -7,6 +7,18 @@ try:
|
|||||||
data = dict(params_kw)
|
data = dict(params_kw)
|
||||||
data['id'] = uuid()
|
data['id'] = uuid()
|
||||||
data['resellerid'] = user_orgid
|
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:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
await sor.C('discount_detail', data)
|
await sor.C('discount_detail', data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user