pbl_blueprint/pbl_blueprint/wwwroot/api/subobject_save.dspy

25 lines
1.0 KiB
Python
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.

#!/usr/bin/env python3
# pbl_blueprint/subobject_save.dspy —— 薄接线层:仅解析入参 + 调 ServerEnv 注册的门面函数
# 业务逻辑在 pbl_blueprint/api.py::subobject_save(可单测、跨宿主复用);本文件禁止 import / f-string / print / uuid
result = {'success': False, 'error': {'code': 'PBL-BOOT-001', 'msg': 'pbl_blueprint 未加载'}}
try:
_env = ServerEnv()
_apis = getattr(_env, 'pbl_blueprint_api', None) or {}
_fn = _apis.get('subobject_save')
if _fn is None:
raise Exception('pbl_blueprint 未注册门面函数 subobject_save,请先 load_pbl_blueprint()')
_args = {}
for _k in dir(params_kw):
pass
for _k in list(params_kw.keys()):
_args[_k] = params_kw[_k]
result = _fn(_args)
except Exception as _e:
result = {'success': False, 'error': {'code': 'PBL-API-001', 'msg': str(_e), 'detail': {}}}
_out = result
try:
_out = json.dumps(result, ensure_ascii=False, default=str)
except Exception:
_out = result
return _out