20 lines
722 B
Plaintext
20 lines
722 B
Plaintext
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
|
|
|
try:
|
|
dbname = get_module_dbname('product_management')
|
|
data = dict(params_kw)
|
|
record_id = data.pop('id', None)
|
|
if not record_id:
|
|
raise ValueError('Missing id')
|
|
data['updated_at'] = timestampstr()
|
|
data['id'] = record_id
|
|
|
|
async with DBPools().sqlorContext(dbname) as sor:
|
|
await sor.U('product_subscription', 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
|