supplychain/wwwroot/api/distribution_agreement_items_create.dspy

24 lines
825 B
Plaintext

result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
try:
user_id = await get_user()
user_orgid = (await get_userorgid()) or '0'
dbname = get_module_dbname('supplychain')
data = dict(params_kw)
data['id'] = getID()
data['resellerid'] = user_orgid
data['created_by'] = user_id
data['created_at'] = timestampstr()
data['updated_at'] = timestampstr()
async with DBPools().sqlorContext(dbname) as sor:
await sor.C('distribution_agreement_items', data)
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '分销协议项目创建成功', 'type': 'success'}}
except Exception as e:
result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'}
return result