entity/wwwroot/api/entity_create.dspy

10 lines
497 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# entity_create.dspy —— 实体新增REST /api/*)。非法输入 100% 拦截不落库。
try:
result = await create_entity(params_kw)
return {'code': 'OK', 'message': 'success', 'data': result}
except Exception as e:
if hasattr(e, 'to_dict'):
err = e.to_dict()
return {'code': err['code'], 'message': err['message'], 'field': err['field'], 'detail': err['detail']}
return {'code': 'DB_ERROR', 'message': '保存实体失败', 'field': '', 'detail': str(e)}