product_management/wwwroot/api/product_resource_supplier_update.dspy
Hermes Agent 24605f88e8 fix: datetime->timestamp for audit fields + fix sor.U/sor.I misuse in core.py and API dspy
- All 7 models: created_at/updated_at changed from datetime to timestamp type
  (DDL template auto-generates DEFAULT CURRENT_TIMESTAMP for timestamp type)
- core.py: fix all sor.U() calls passing 3 args (id must be in data dict)
- core.py: fix sor.I() misuse for INSERT (should be sor.C())
- API dspy updates: fix sor.U() 3-arg bug in category/product/type_config/resource/subscription/supplier
- product_resource_supplier_update.dspy: add missing updated_at field
2026-06-22 11:04:46 +08:00

20 lines
768 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_resource_supplier', 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)