- json/discount_list.json: dataurl→/appbase/, resellerid隐藏+自动填充, customerid保留下拉 - json/discount_detail_list.json: dataurl→/appbase/ - 新增6个API: discount和discount_detail的create/update/delete - load_path.py: 注册新API路径到logined和operator
20 lines
684 B
Plaintext
20 lines
684 B
Plaintext
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
|
|
|
try:
|
|
user_orgid = (await get_userorgid()) or '0'
|
|
dbname = get_module_dbname('discount')
|
|
|
|
data = dict(params_kw)
|
|
data['id'] = getID()
|
|
data['resellerid'] = user_orgid
|
|
|
|
async with DBPools().sqlorContext(dbname) as sor:
|
|
await sor.C('discount', data)
|
|
|
|
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '折扣方案创建成功', 'type': 'success'}}
|
|
|
|
except Exception as e:
|
|
result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'}
|
|
|
|
return json.dumps(result, ensure_ascii=False)
|